Repository navigation
Processing crash: android.support.v4.app.DialogFragment$DialogStyle not found #1435
Description
Activity
Please provide the full stack trace and the annotated code.
I've encountered the same error. Below is the stacktrace from androidannotations.log.
14:17:30.910 [Daemon worker Thread 17] INFO o.a.p.TimeStats:81 - Time measurements: [Whole Processing = 106 ms], 14:17:30.910 [Daemon worker Thread 17] INFO o.a.AndroidAnnotationProcessor:121 - Finish processing 14:19:55.938 [Daemon worker Thread 18] INFO o.a.AndroidAnnotationProcessor:83 - Initialize AndroidAnnotations 3.3.1 with options {androidManifestFile=/home/hirdian/Documents/GudPoinAndroid/app/build/intermediates/manifests/full/debug/AndroidManifest.xml, resourcePackageName=com.gudpoin} 14:19:55.999 [Daemon worker Thread 18] INFO o.a.AndroidAnnotationProcessor:107 - Start processing for 24 annotations on 240 elements 14:19:56.102 [Daemon worker Thread 18] ERROR o.a.AndroidAnnotationProcessor:267 - Something went wrong: Unexpected error in AndroidAnnotations 3.3.1! You should check if there is already an issue about it on https://github.com/excilys/androidannotations/search?q=com.sun.tools.javac.code.Symbol%24CompletionFailure&type=Issues If none exists, please open a new one with the following content and tell us if you can reproduce it or not. Don't forget to give us as much information as you can (like parts of your code in failure). Java version: javac 1.7.0_80 Javac processors options: androidManifestFile=/home/hirdian/Documents/GudPoinAndroid/app/build/intermediates/manifests/full/debug/AndroidManifest.xml, resourcePackageName=com.gudpoin Stacktrace: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.support.v4.app.DialogFragment$DialogStyle not found 14:19:56.102 [Daemon worker Thread 18] INFO o.a.p.TimeStats:81 - Time measurements: [Whole Processing = 103 ms], 14:19:56.102 [Daemon worker Thread 18] INFO o.a.AndroidAnnotationProcessor:121 - Finish processingI do have a class extending DialogFragment annotated, like so:
@EFragment(R.layout.some_layout) public class HomeOverflowFragment extends DialogFragment{ //Some Code }I've also tried removing the annotation in that class and the error is still there. Using appcompat-v7:22.2.0. Hope this could help.
This is weird, because the whole stacktrace is not shown, only the message of the exception. Did you copy the whole trace?
Yep, that is the only content inside androidannotations.log after the build failed.
Only one line is written in log file.
Can one of you guys create a minimal example project which can reproduce the issue?
Same here.
In my log also:
Note: Resolve log file to /home/dsuszczewicz/dev/repo/AndroidMenuOrder/Mordor/core/build/generated/source/apt/androidannotations.log Note: Initialize AndroidAnnotations 3.2 with options {androidManifestFile=/home/dsuszczewicz/dev/repo/AndroidMenuOrder/Mordor/core/build/intermediates/bundles/release/aapt/AndroidManifest.xml} Warning:The following options were not recognized by any processor: '[androidManifestFile]' :core:compileRetrolambdaRelease :core:extractReleaseAnnotations :core:mergeReleaseProguardFiles UP-TO-DATE"Please provide more detail about the issue. This happened after you upgraded to AppCompat 22.2?
just as note: for me 22.2.0 works with AA 3.3.1. i only had to add some proguard -dontwarn for my release build
This issue is getting really confusing, and i still lack basic information. Please guys provide as much details as possible, according to our issue guide. A repro project would be the most help.
If I don't use support.v4.app.DialogFragment on my project, there are no error.
If I use support.v4.app.DialogFragment on my project, there is above error.
(Even if I use @efragment for my fragment.)I made small sample
https://github.com/matsujun/AAIssueI just created template app with AndroidStudio,
applied @EActivity to MyActivity,
and made meaningless MyDialogFragment extends support.v4.app.DialogFragment.Thanks, great! I will look at it soon.
I suspect what is the problem. There is an inner annotation in the
DialogFragmentclass,@DialogFragment.DialogStyle. This annotation is used only at one place, in theDialogFragment.setStyle(@DialogStyle int style, @StyleRes int theme)method.The problem happens in
ModelExtractor.extractAncestorsAnnotations. This method is used to collect all annotations which are found on the parent classes of the actual "root" classes. When we reachMyDialogFragment, we iterate over its parents, then we hitDialogFragment. We iterate over all enclosed elements (inner classes, methods, fields, etc) in that class, so we findDialogFragment.setStyle. And this is where the problem occurs. The retention policy of@DialogFragment.DialogStyleisSOURCE. So the annotation usage is found, but its class file cannot be loaded, and we fail...This annotation was added in support lib version
20.0.0.A little correction: the retention policy was always
SOURCE. Interestingly, the support lib still contained the .class file for@DialogFragment.DialogStyle, that is why AA worked. Since support lib version22.2, this .class file is no longer present in the AAR (which is correct according to its retention). I do not know why it was present despite its source-only retention in earlier versions, but that was our luck.30 remaining items
@danpe there will be for sure, but nobody knows when.
Why is this a Google Bug though ? the support library v4 works without androidannotations
@danpe i already explained here (see this #1435 (comment) and down), and i also reported this to Google, they confirmed this is a bug. Luckily the bug does not effect "normal" builds, but causes troubles with annotation processors which are scanning the classes, like AndroidAnnotations, Dagger and Transfuse. ProGuard also suffers from this.
But we can create a workaround at AA side. If i would have know Google is not fixing this too soon, maybe i would have already create that workaround.Since Google is still not reacting, we are adding a workaround for this into AndroidAnnotations.
We just released AndroidAnnotations 3.3.2, which addresses this issue. Update to it, and you no longer have to use workarounds in build.gradle with Support Library 22.2.0.
@WonderCsabo Thank you for the fix. The previous workaround failed on emulators and some older Motorola and Samsung devices. You just saved my automated tests and my sanity.
support lib 22.2.1 has been released. according to this comment it seems that the issue has been fixed
Indeed, i can verify it. However AA 3.3.2 already fixed this problem from our side. :)
Reacted by hwryeah, i just wanted to mention it here :)
- Thanks for doing that! You are right, it was worth mentioning, because other libraries still suffered from this bug.
When I use support library v22.2, I got following error.
のクラス・ファイルが見つかりませんisClass, File not found.support.v4.app.DialogFragment on v22.1 or earlier seems to have
private @interface DialogStyle {}But it seems to be removed on v22.2.