You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Processing crash: android.support.v4.app.DialogFragment$DialogStyle not found #1435
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 processing
I 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.
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"
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 just created template app with AndroidStudio,
applied @EActivity to MyActivity,
and made meaningless MyDialogFragment extends support.v4.app.DialogFragment.
I suspect what is the problem. There is an inner annotation in the DialogFragment class, @DialogFragment.DialogStyle. This annotation is used only at one place, in the DialogFragment.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 reach MyDialogFragment, we iterate over its parents, then we hit DialogFragment. We iterate over all enclosed elements (inner classes, methods, fields, etc) in that class, so we find DialogFragment.setStyle. And this is where the problem occurs. The retention policy of @DialogFragment.DialogStyle is SOURCE. 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 version 22.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.
@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.
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.
Activity
WonderCsabo commentedon May 29, 2015
Please provide the full stack trace and the annotated code.
savannabreeze commentedon May 29, 2015
I've encountered the same error. Below is the stacktrace from androidannotations.log.
I do have a class extending DialogFragment annotated, like so:
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.
WonderCsabo commentedon May 29, 2015
This is weird, because the whole stacktrace is not shown, only the message of the exception. Did you copy the whole trace?
savannabreeze commentedon May 29, 2015
Yep, that is the only content inside androidannotations.log after the build failed.
matsujun commentedon May 29, 2015
Only one line is written in log file.
WonderCsabo commentedon May 29, 2015
Can one of you guys create a minimal example project which can reproduce the issue?
domsu commentedon May 29, 2015
Same here.
In my log also:
WonderCsabo commentedon May 29, 2015
Please provide more detail about the issue. This happened after you upgraded to AppCompat 22.2?
dodgex commentedon May 29, 2015
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
WonderCsabo commentedon May 29, 2015
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.
matsujun commentedon May 29, 2015
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.)
matsujun commentedon May 29, 2015
I made small sample
https://github.com/matsujun/AAIssue
I just created template app with AndroidStudio,
applied @EActivity to MyActivity,
and made meaningless MyDialogFragment extends support.v4.app.DialogFragment.
WonderCsabo commentedon May 29, 2015
Thanks, great! I will look at it soon.
WonderCsabo commentedon May 29, 2015
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.WonderCsabo commentedon May 29, 2015
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
WonderCsabo commentedon Jul 7, 2015
@danpe there will be for sure, but nobody knows when.
danpe commentedon Jul 8, 2015
Why is this a Google Bug though ? the support library v4 works without androidannotations
WonderCsabo commentedon Jul 8, 2015
@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.
WonderCsabo commentedon Jul 9, 2015
Since Google is still not reacting, we are adding a workaround for this into AndroidAnnotations.
WonderCsabo commentedon Jul 10, 2015
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.
justin-fiedler commentedon Jul 10, 2015
@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.
dodgex commentedon Jul 18, 2015
support lib 22.2.1 has been released. according to this comment it seems that the issue has been fixed
WonderCsabo commentedon Jul 18, 2015
Indeed, i can verify it. However AA 3.3.2 already fixed this problem from our side. :)
dodgex commentedon Jul 18, 2015
yeah, i just wanted to mention it here :)
WonderCsabo commentedon Jul 18, 2015