我在测试应用程序中实现ActionBarSherlock
时遇到问题。
如果主Activity是Activity
的子类,一切都很完美,但是当我继承SherlockActivity
时,我得到一个例外:
12-13 11:33:02.630: E/AndroidRuntime(11345): FATAL EXCEPTION: main
12-13 11:33:02.630: E/AndroidRuntime(11345): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pl.lsi.test.packages/pl.lsi.test.packages.MainActivity}: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Looper.loop(Looper.java:137)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.NativeStart.main(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): Caused by: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
12-13 11:33:02.630: E/AndroidRuntime(11345): ... 11 more
将SherlockTheme
应用于清单时也遇到问题(Sherlock样式不可见)。
答案 0 :(得分:1)
然后在values文件夹中,你必须在styles.xml文件中添加样式.... 我想你错过了一些放在那里的文件