I am using the following ProGuard rules:
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao { *; } -keep class **$Properties -keep class org.greenrobot.greendao.** -keepclassmembers class org.greenrobot.greendao.** { *; } # If you do not use SQLCipher: -dontwarn org.greenrobot.greendao.database.** # If you do not use RxJava: -dontwarn rx.**
When starting the app I get the following crash log:
java.lang.RuntimeException: Unable to create application my.app.package.MyApplication: org.greenrobot.greendao.DaoException: Could not init DAOConfig at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4569) at android.app.ActivityThread.access$1500(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5272) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704) Caused by: org.greenrobot.greendao.DaoException: Could not init DAOConfig at org.greenrobot.greendao.internal.DaoConfig.(Unknown Source) at org.greenrobot.greendao.AbstractDaoMaster.registerDaoClass(Unknown Source) at my.app.package.database.model.DaoMaster.(Unknown Source) at my.app.package.database.model.DaoMaster.(Unknown Source) at my.app.package.ZamgApplication.onCreate(Unknown Source) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) at android.app.ActivityThread.access$1500(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5272) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704) Caused by: java.lang.ArrayIndexOutOfBoundsException: length=5; index=6 at org.greenrobot.greendao.internal.DaoConfig.reflectProperties(Unknown Source) at org.greenrobot.greendao.internal.DaoConfig.(Unknown Source) at org.greenrobot.greendao.AbstractDaoMaster.registerDaoClass(Unknown Source) at my.app.package.database.model.DaoMaster.(Unknown Source) at my.app.package.database.model.DaoMaster.(Unknown Source) at my.app.package.ZamgApplication.onCreate(Unknown Source) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) at android.app.ActivityThread.access$1500(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5272) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
When compiling the app without ProGuard, everything works fine.
Am I missing any configuration here? i couldn't find anything with Google on this...
It seems that the instruction:
is not being applied. As you can see in the logs, lines like:
show that classes under
org.greenrobot.greendao
are being obfuscated while your ProGuard directive is telling (or was suppose to tell) ProGuard to leave them unchanged. To fix this, make sure that the ProGuard rules file where this is define is being correctly referenced in theproguardFiles
section of your Android configuration:and that your release configuration(s) use the same
proguard-rules.pro
file.