Reputation: 1396
When I build my application with signed APK I get a lot of "can't find referenced class" errors. I did put some of these don't warn messages in my pro guard-rules.pro (for app) but then when I run the release Build Variant it fails on JSON not able to recognize fields. The following are my don't warn statements I put earlier but removed:
#Warnings to be removed. Otherwise maven plugin stops, but not dangerous
#-dontwarn android.support.**
#-dontwarn com.sun.xml.internal.**
#-dontwarn com.sun.istack.internal.**
#-dontwarn org.codehaus.jackson.**
#-dontwarn org.springframework.**
#-dontwarn java.awt.**
#-dontwarn javax.security.**
#-dontwarn java.beans.**
#-dontwarn javax.xml.**
#-dontwarn java.util.**
#-dontwarn org.w3c.dom.**
#-dontwarn com.google.common.**
#-dontwarn com.octo.android.robospice.persistence.**
#
When I have removed those I get the following warns:
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
I am not sure if my dependencies such as:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile "com.google.android.gms:play-services-gcm:8.3.0"
// compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.android.support:support-v13:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'jackson:jackson-asl:0.9.3'
compile 'com.android.support:design:23.+'
are getting put in the release build. Currently they are in app's build.gradle file. Should I put them somewhere else?
thanks -Sonam
Upvotes: 2
Views: 1606
Reputation: 1396
I managed to get it to work. I put back the "-dontwarn" statements. I also had to put the following statements to not obfuscate my model getter/setters as it was not able to marshall to their object types.
-keep public class your.domain.package.* {
public *** get*();
public void set*(***);
}
This got my app working.
Upvotes: 1
Reputation: 394
If you enabled proguard for signed apk, exclude the packages/classes/.. in the proguard rules file.
Upvotes: 0