java.lang.NoClassDefFoundError: roboguice.activity.SherlockAccountAuthenticatorActivity with ActiveAndroid in android 5.0
java.lang.NoClassDefFoundError: roboguice.activity.SherlockAccountAuthenticatorActivity with ActiveAndroid in android 5.0
我收到这个错误 -
java.lang.NoClassDefFoundError: roboguice.activity.SherlockAccountAuthenticatorActivity
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at com.dvor.androidapp.Application.TabletApplication.onCreate(TabletApplication.java:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
at android.app.ActivityThread.access00(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
在 Android 5.0 版中,我正在使用 RoboGuice 和 ActiveAndroid 并且应用程序 class 正在扩展 com.activeandroid.app.Application,有没有其他方法可以解决这个问题除了扩展普通应用程序 class 和手动添加模型 classes 之外的问题(这样每个模型 class 都需要添加),如解释的那样(https://github.com/pardom/ActiveAndroid/issues/291):
Configuration.Builder configurationBuilder = new Configuration.Builder(this);
configurationBuilder.addModelClass(Test.class);
configurationBuilder.addModelClass(Test2.class);
ActiveAndroid.initialize(configurationBuilder.create());
此问题的解决方法是将 Roboguice jar 文件和 ActiveAndroid jar 文件添加到 lib 文件夹,并将 Gradle "compile" 命令替换为 -
compile files('libs/ActiveAndroid.jar')
compile files('libs/simple.facebook-2.2.jar')
compile files('libs/guice-3.0-no_aop.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/roboguice-3.0b-experimental.jar')
我收到这个错误 -
java.lang.NoClassDefFoundError: roboguice.activity.SherlockAccountAuthenticatorActivity
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at com.dvor.androidapp.Application.TabletApplication.onCreate(TabletApplication.java:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
at android.app.ActivityThread.access00(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
在 Android 5.0 版中,我正在使用 RoboGuice 和 ActiveAndroid 并且应用程序 class 正在扩展 com.activeandroid.app.Application,有没有其他方法可以解决这个问题除了扩展普通应用程序 class 和手动添加模型 classes 之外的问题(这样每个模型 class 都需要添加),如解释的那样(https://github.com/pardom/ActiveAndroid/issues/291):
Configuration.Builder configurationBuilder = new Configuration.Builder(this);
configurationBuilder.addModelClass(Test.class);
configurationBuilder.addModelClass(Test2.class);
ActiveAndroid.initialize(configurationBuilder.create());
此问题的解决方法是将 Roboguice jar 文件和 ActiveAndroid jar 文件添加到 lib 文件夹,并将 Gradle "compile" 命令替换为 -
compile files('libs/ActiveAndroid.jar')
compile files('libs/simple.facebook-2.2.jar')
compile files('libs/guice-3.0-no_aop.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/roboguice-3.0b-experimental.jar')