i recently upgraded android studio but im not able to find the source of the following issue reported in android studio 3.1:
Warning: The rule `-keep public clas
class android.support.annotation.Keep
is what I use (Android Studio 3.1.2
) ...
-keep @interface android.support.annotation.Keep
-keep @android.support.annotation.Keep class *
-keepclasseswithmembers class * {
@android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <methods>;
}
there are further flags to control which annotations to keep:
-keepattributes RuntimeVisibleAnnotations
-keepattributes AnnotationDefault
-keepattributes *Annotation*
one can get the raw output by running ./gradlew assembleRelease
in the terminal tab.
when nothing in the project's ProGuard configuration refers to Annotation
, this warning might originate from the "consumer" rules of some referenced library, to be obfuscated at build time.
hence it appears to be a harmless warning, one can possibly mute it:
-dontwarn java.lang.annotation.Annotation
This issue comes when you upload new upgrade version on google play store and after upload most users click on retain and then submit. Don't click on Retain just upload and submit. Your apk file uploaded successfully and Retain file automatically discard and set in deactivate mode.
Remember : Make sure your put all details of new update different to older version.
used implementation 'com.android.support:support-annotations:27.1.1' in app dependancy
version choose according to your app compat version
You are missing a space between the wildcard *
and the keyword extends
.
The warning itself probably does not come from ProGuard but from the builtin shrinker of google.
If you can not find it in your project, then it is most likely a broken rule from a consumer Proguard file included in of the the dependent aar files.
I removed the "multiDexEnabled true" from app's build gradle defaultConfig and the WARNING goes away:
defaultConfig {
...
//multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "Xg"
}
good luck)
I got same issue because of "multiDexEnabled true" setting in gradle defaultConfig.
I resolved this issue by adding multidex dependency "implementation 'com.android.support:multidex:1.0.3'"
android {
defaultConfig {
...
multiDexEnabled true
}
...
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
Reference : https://developer.android.com/studio/build/multidex