gpt4 book ai didi

android - 仅使用 Proguard : Could not init DaoConfig => ArrayIndexOutOfBoundsException

转载 作者:IT老高 更新时间:2023-10-28 23:23:41 30 4
gpt4 key购买 nike

我正在使用以下 ProGuard 规则:

-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.**

启动应用程序时,我收到以下崩溃日志:

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) 

在没有 ProGuard 的情况下编译应用程序时,一切正常。

我在这里缺少任何配置吗?我在 Google 上找不到任何内容...

最佳答案

您是否在项目中保留 Entity 类?
如果没有,keep 你放置 Entity 类的包
像这样
-keep class com.xxx.xxx.model.* {*;}

关于android - 仅使用 Proguard : Could not init DaoConfig => ArrayIndexOutOfBoundsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42023703/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com