After updating android-support
library to 22.2.0
project stopped compiling.
error: cannot access DialogStyle
class file for android.support.v4.app.DialogFragment$DialogStyle not found
Consult the following stack trace for details.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.support.v4.app.DialogFragment$DialogStyle not found
Can't find how to work around this issue.
Previously used version was 22.1.1
@takoli's answer works in most cases but if you have other dependencies that silently include support-v4 or if you are too lazy to explicitly exclude support-v4 everywhere here is another solution.
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:mediarouter-v7:22.2.0'
// Force stable version of support-v4
compile ('com.android.support:support-v4:22.1.1') {
force = true
}
Update:
AndroidAnnotations released a new version 3.3.2 that resolves this issue. If you are using AndroidAnnotations update to 3.3.2 and use the 22.2.0 support libraries without forcing the old version of support-v4. For more information see this thread
Here is a couple workarounds that worked for us:
I just found a TEMPORARY workaround... till appcompat fixes this issue:
android.support.v4.app
DialogFragment$DialogStyle.java
Contents
package android.support.v4.app;
// todo remove this file when fixed in appcompat (https://code.google.com/p/android/issues/detail?id=175086)
public @interface DialogFragment$DialogStyle { }
I found another work-around.... a bit more ugly... but has gotten us around this issue (including the NPE on the above work-around) till appcompat 22.2 is fixed.
android.support.v4.app
https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v4/java/android/support/v4/app/DialogFragment.java
Rename the class (to something like TempFragmentDialog). You will get a "Duplicate" class error if you don't rename the class.
Any FragmentDialog, in your project, that has @Inject will need to extend your copy of the FragmentDialog (example: public class MyFragmentDialog extends TempFragmentDialog)
Try this, it resolved my issue:
compile ('com.android.support:appcompat-v7:22.2.0') {
exclude module: 'support-v4' }
compile ('com.android.support:recyclerview-v7:22.2.0') {
exclude module: 'support-v4' }
compile ('com.android.support:cardview-v7:22.2.0') {
exclude module: 'support-v4' }
compile ('com.android.support:design:22.2.0') {
exclude module: 'support-v4' }
// and exclude support-v4 from other dependencies as well that might include it
// finally add it, but avoid version 22.2.0...
compile ('com.android.support:support-v4:22.1.1')
There is no need to manually add the support-v4 library to your libs directory, the last import ensures that the right version is included in your project.
BTW all of this workaround is not your fault, blame others :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With