After updating android-support
library to 22.2.0
project stopped compiling.
error: cannot access DialogStyle
class file for android.s
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)
Simply put, this is a bug in support library version 22.2.0
Just upgrade to the next update 22.2.1, works like a charm.
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 :)
It happens if you are using android.support.v4.app.DialogFragment. Try to use android.app.DialogFragment instead.
Just in case to not to skip an answer: here is also a discussion about this problem https://github.com/excilys/androidannotations/issues/1435
BTW, do you use Android Annotations in a project where this problem exists ?
@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