如何使用具有app compat库的Holo Everywhere

时间:2014-09-15 13:29:32

标签: android android-support-library android-holo-everywhere

我最近决定在我的项目中到处使用Holo。所以我下载了图书馆&将它添加到我的项目中。

由于库支持AppCompat库,我从项目中删除了现有的AppCompat库。

但是当我设置主题时,它会强制关闭。

如何解决这个问题?

编辑:这是logcat

09-15 19:05:34.344: E/dalvikvm(316): Could not find class 'android.test.mock.MockApplication', referenced from method android.support.v4.app._HoloActivity.onInit
09-15 19:05:34.344: W/dalvikvm(316): VFY: unable to resolve instanceof 830 (Landroid/test/mock/MockApplication;) in Landroid/support/v4/app/_HoloActivity;
09-15 19:05:34.344: D/dalvikvm(316): VFY: replacing opcode 0x20 at 0x0035
09-15 19:05:34.364: D/dalvikvm(316): VFY: dead code 0x0037-0042 in Landroid/support/v4/app/_HoloActivity;.onInit (Landroid/support/v4/app/_HoloActivity$Holo;Landroid/os/Bundle;)V
09-15 19:05:34.364: D/dalvikvm(316): VFY: dead code 0x006c-006d in Landroid/support/v4/app/_HoloActivity;.onInit (Landroid/support/v4/app/_HoloActivity$Holo;Landroid/os/Bundle;)V
09-15 19:05:34.384: I/dalvikvm(316): Could not find method android.support.v7.app.ActionBarActivity.startActivityForResult, referenced from method android.support.v4.app._HoloActivity.superStartActivity
09-15 19:05:34.384: W/dalvikvm(316): VFY: unable to resolve virtual method 5147: Landroid/support/v7/app/ActionBarActivity;.startActivityForResult (Landroid/content/Intent;ILandroid/os/Bundle;)V
09-15 19:05:34.394: D/dalvikvm(316): VFY: replacing opcode 0x6f at 0x0006
09-15 19:05:34.434: E/ResourceType(316): Style contains key with bad entry: 0x010102d4
09-15 19:05:34.454: I/dalvikvm(316): Could not find method android.app.Application.startActivity, referenced from method org.holoeverywhere.app.Application.superStartActivity
09-15 19:05:34.454: W/dalvikvm(316): VFY: unable to resolve virtual method 124: Landroid/app/Application;.startActivity (Landroid/content/Intent;Landroid/os/Bundle;)V
09-15 19:05:34.464: D/dalvikvm(316): VFY: replacing opcode 0x6f at 0x0006
09-15 19:05:34.614: D/dalvikvm(316): GC_FOR_MALLOC freed 2355 objects / 186088 bytes in 132ms
09-15 19:05:34.634: D/AndroidRuntime(316): Shutting down VM
09-15 19:05:34.634: W/dalvikvm(316): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
09-15 19:05:34.675: E/AndroidRuntime(316): FATAL EXCEPTION: main
09-15 19:05:34.675: E/AndroidRuntime(316): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.firengine.mdplyr/com.firengine.mdplyr.MainActivity}: java.lang.IllegalStateException: Application instance isn't HoloEverywhere.
09-15 19:05:34.675: E/AndroidRuntime(316): Put attr 'android:name="org.holoeverywhere.app.Application"' in <application> tag of AndroidManifest.xml
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.os.Looper.loop(Looper.java:123)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread.main(ActivityThread.java:4627)
09-15 19:05:34.675: E/AndroidRuntime(316):  at java.lang.reflect.Method.invokeNative(Native Method)
09-15 19:05:34.675: E/AndroidRuntime(316):  at java.lang.reflect.Method.invoke(Method.java:521)
09-15 19:05:34.675: E/AndroidRuntime(316):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-15 19:05:34.675: E/AndroidRuntime(316):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-15 19:05:34.675: E/AndroidRuntime(316):  at dalvik.system.NativeStart.main(Native Method)
09-15 19:05:34.675: E/AndroidRuntime(316): Caused by: java.lang.IllegalStateException: Application instance isn't HoloEverywhere.
09-15 19:05:34.675: E/AndroidRuntime(316): Put attr 'android:name="org.holoeverywhere.app.Application"' in <application> tag of AndroidManifest.xml
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.support.v4.app._HoloActivity.onInit(_HoloActivity.java:284)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.support.v4.app._HoloActivity.forceInit(_HoloActivity.java:105)
09-15 19:05:34.675: E/AndroidRuntime(316):  at org.holoeverywhere.app.Activity.onCreate(Activity.java:142)
09-15 19:05:34.675: E/AndroidRuntime(316):  at com.firengine.mdplyr.MainActivity.onCreate(MainActivity.java:13)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-15 19:05:34.675: E/AndroidRuntime(316):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-15 19:05:34.675: E/AndroidRuntime(316):  ... 11 more
09-15 19:05:36.984: I/Process(316): Sending signal. PID: 316 SIG: 9

1 个答案:

答案 0 :(得分:0)

请勿使用App Compat Library。它包含在HoloEverywhere内。

修改

来自日志:

  

应用程序实例不是HoloEverywhere。

你必须在你的清单中设置:

<application
    android:name="org.holoeverywhere.app.Application"
    ...
>

或从org.holoeverywhere.app.Application扩展您的Application类。