(Proguard) Server Build Error Codename One

2019-04-13 16:46发布

问题:

After adding an Android Certificate in my project, the Codename One server started getting issues to build, then by asking the Codename One support, they told me it could be something related to the Proguard, so after disabling the Proguard by setting android.enableProguard=false which is not recommended right? So after doing it the Codename One server builds fine, but I want to keep the Proguard enable since it's the recommeded, but when I keep it enable the Codename One server gets build error with the following error log: https://s3.amazonaws.com/codenameone-build-response/d5f3c0c7-71a3-4a17-9f19-1c4e8fb3903d-1523988845519-error.txt

In addition the only libraries I'm using are: cn1-codescan.cn1lib, CN1JSON.cn1lib and parse4cn1.cn1lib

Am I missing Proguard build hints? I'm using the following Proguard build hints:

android.proguardKeep=-keep class com.mypackage.ProblemClass { *; } -keep class android.support.v4.** { *; } -keep class android.support.v7.** { *; } -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.app.Activity -keep public class * extends android.preference.Preference -keep public class com.freshdesk.mobihelp.exception.MobihelpComponentNotFoundException -keepclassmembers class * implements android.os.Parcelable {   public static final android.os.Parcelable$Creator *; }

回答1:

You need to replace the word ProblemClass with the full path to the class that is causing the problem...

You wrote this:

android.proguardKeep=-keep class com.mypackage.ProblemClass { *; } -keep class android.support.v4.** { *; } -keep class android.support.v7.** { *; } -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.app.Activity -keep public class * extends android.preference.Preference -keep public class com.freshdesk.mobihelp.exception.MobihelpComponentNotFoundException -keepclassmembers class * implements android.os.Parcelable {   public static final android.os.Parcelable$Creator *; }

You should have written this for com.parse.ParseOkHttpClient :

android.proguardKeep=-keep class com.parse.ParseOkHttpClient { *; } -keep class android.support.v4.** { *; } -keep class android.support.v7.** { *; } -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.app.Activity -keep public class * extends android.preference.Preference -keep public class com.freshdesk.mobihelp.exception.MobihelpComponentNotFoundException -keepclassmembers class * implements android.os.Parcelable {   public static final android.os.Parcelable$Creator *; }