Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
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

Description

@matsujun

When I use support library v22.2, I got following error.

Stacktrace: com.sun.tools.javac.code.Symbol$CompletionFailure: android.support.v4.app.DialogFragment$DialogStyleのクラス・ファイルが見つかりません

のクラス・ファイルが見つかりません is Class, 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.

Activity

  1. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    Please provide the full stack trace and the annotated code.

  2. savannabreeze commented on May 29, 2015

    @savannabreeze

    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.

  3. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    This is weird, because the whole stacktrace is not shown, only the message of the exception. Did you copy the whole trace?

  4. savannabreeze commented on May 29, 2015

    @savannabreeze

    Yep, that is the only content inside androidannotations.log after the build failed.

  5. matsujun commented on May 29, 2015

    @matsujun
    Author

    Only one line is written in log file.

  6. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    Can one of you guys create a minimal example project which can reproduce the issue?

  7. domsu commented on May 29, 2015

    @domsu

    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"
    
  8. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    Please provide more detail about the issue. This happened after you upgraded to AppCompat 22.2?

  9. dodgex commented on May 29, 2015

    @dodgex
    Member

    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

  10. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    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.

  11. matsujun commented on May 29, 2015

    @matsujun
    Author

    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.)

  12. matsujun commented on May 29, 2015

    @matsujun
    Author

    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.

  13. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    Thanks, great! I will look at it soon.

  14. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    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.

  15. WonderCsabo commented on May 29, 2015

    @WonderCsabo
    Member

    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.

  16. 30 remaining items

  17. WonderCsabo commented on Jul 7, 2015

    @WonderCsabo
    Member

    @danpe there will be for sure, but nobody knows when.

  18. danpe commented on Jul 8, 2015

    @danpe

    Why is this a Google Bug though ? the support library v4 works without androidannotations

  19. WonderCsabo commented on Jul 8, 2015

    @WonderCsabo
    Member

    @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.

  20. WonderCsabo commented on Jul 9, 2015

    @WonderCsabo
    Member

    Since Google is still not reacting, we are adding a workaround for this into AndroidAnnotations.

  21. self-assigned this
    on Jul 9, 2015
  22. WonderCsabo commented on Jul 10, 2015

    @WonderCsabo
    Member

    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.

  23. justin-fiedler commented on Jul 10, 2015

    @justin-fiedler

    @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.

  24. dodgex commented on Jul 18, 2015

    @dodgex
    Member

    support lib 22.2.1 has been released. according to this comment it seems that the issue has been fixed

  25. WonderCsabo commented on Jul 18, 2015

    @WonderCsabo
    Member

    Indeed, i can verify it. However AA 3.3.2 already fixed this problem from our side. :)

  26. dodgex commented on Jul 18, 2015

    @dodgex
    Member

    yeah, i just wanted to mention it here :)

  27. WonderCsabo commented on Jul 18, 2015

    @WonderCsabo
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions