I have a project which uses a WelcomeActivity
which extends FragmentActivity
. I use the support library, so android-support-v4.jar
is in the libs
folder. When I run this app, there are no problems.
我有一个项目,它使用了一种扩展了碎片活动的WelcomeActivity。我使用支持库,所以android- supportv4。jar在libs文件夹中。当我运行这个应用程序时,没有问题。
However, I want to add ActionBarSherlock to the project. In the ABS project I use actionbarsherlock-plugin-maps-4.1.0.jar
and android-support-v4-r6-googlemaps.jar
in the libs
folder. In my app project I add the ABS library, and when I try to run the app, this error occurs:
但是,我想把ActionBarSherlock加入到这个项目中。在ABS项目中,我使用actionbarsherlock-plugin-map -4.1.0。jar和android-support-v4-r6-googlemaps。jar在libs文件夹中。在我的app项目中,我添加了ABS程序库,当我尝试运行app时,会出现以下错误:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
To solve this, I removed the android-support-v4.jar
from my app's libs
folder. When I now start my app, the app crashes with this logcat:
为了解决这个问题,我删除了android- supportv4。jar来自我的应用程序的libs文件夹。当我启动我的应用程序时,这个应用程序崩溃了。
08-01 18:59:11.182: W/dalvikvm(13338): Unable to resolve superclass of Landroid/support/v4/app/FragmentActivity; (620)
08-01 18:59:11.182: W/dalvikvm(13338): Link of class 'Landroid/support/v4/app/FragmentActivity;' failed
08-01 18:59:11.182: W/dalvikvm(13338): Unable to resolve superclass of Lcom/myapp/welcome/WelcomeActivity; (109)
08-01 18:59:11.182: W/dalvikvm(13338): Link of class 'Lcom/myapp/welcome/WelcomeActivity;' failed
08-01 18:59:11.182: E/dalvikvm(13338): Could not find class 'com.myapp.welcome.WelcomeActivity', referenced from method com.myapp.MainDispatcherActivity.startWelcomeActivity
08-01 18:59:11.182: W/dalvikvm(13338): VFY: unable to resolve const-class 690 (Lcom/myapp/welcome/WelcomeActivity;) in Lcom/myapp/MainDispatcherActivity;
08-01 18:59:11.182: D/dalvikvm(13338): VFY: replacing opcode 0x1c at 0x0002
08-01 18:59:11.182: D/dalvikvm(13338): VFY: dead code 0x0004-000b in Lcom/myapp/MainDispatcherActivity;.startWelcomeActivity ()V
08-01 18:59:11.182: D/AndroidRuntime(13338): Shutting down VM
08-01 18:59:11.182: W/dalvikvm(13338): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-01 18:59:11.182: E/AndroidRuntime(13338): FATAL EXCEPTION: main
08-01 18:59:11.182: E/AndroidRuntime(13338): java.lang.NoClassDefFoundError: com.myapp.welcome.WelcomeActivity
08-01 18:59:11.182: E/AndroidRuntime(13338): at com.myapp.MainDispatcherActivity.startWelcomeActivity(MainDispatcherActivity.java:33)
08-01 18:59:11.182: E/AndroidRuntime(13338): at com.myapp.MainDispatcherActivity.startProperActivity(MainDispatcherActivity.java:26)
08-01 18:59:11.182: E/AndroidRuntime(13338): at com.myapp.MainDispatcherActivity.onCreate(MainDispatcherActivity.java:19)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.os.Handler.dispatchMessage(Handler.java:99)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.os.Looper.loop(Looper.java:130)
08-01 18:59:11.182: E/AndroidRuntime(13338): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-01 18:59:11.182: E/AndroidRuntime(13338): at java.lang.reflect.Method.invokeNative(Native Method)
08-01 18:59:11.182: E/AndroidRuntime(13338): at java.lang.reflect.Method.invoke(Method.java:507)
08-01 18:59:11.182: E/AndroidRuntime(13338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
08-01 18:59:11.182: E/AndroidRuntime(13338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-01 18:59:11.182: E/AndroidRuntime(13338): at dalvik.system.NativeStart.main(Native Method)
How can I fix this?
我怎么解决这个问题?
Edit
I have another project which uses the same ABS library, and runs fine. I have no idea what I've done differently, or which settings are wrong.
编辑我有另一个项目使用相同的ABS库,并且运行良好。我不知道我做了哪些不同的事情,或者哪些设置是错误的。
4 个解决方案
#1
13
It seems this error occurred because I didn't have this line in the AndroidManifest.xml file, in the <application>
tag:
看起来这个错误发生是因为我在AndroidManifest中没有这一行。xml文件,在 <应用程序> 标签:
<uses-library android:name="com.google.android.maps" />
#2
9
Click here
点击这里
I think it is the same problem at the Build Path-> Configure Build Path -> Order and Export, the "android-support-v4.jar" needs to be checked.
我认为在构建路径->配置构建路径->订单和导出,“android-support-v4”也是同样的问题。jar需要检查。
Hope it is useful to you.
希望它对你有用。
#3
2
Have you set the compiler compliance for the actionbarsherlock library project? Right click on the library project, go to properties. Under java compiler, make sure compliance is set to 1.6. I had a similar issue, and found the compliance set to 1.5.
您是否设置了actionbarsherlock库项目的编译器遵从性?右键点击库项目,进入属性。在java编译器下,确保遵从性设置为1.6。我有一个类似的问题,发现遵从性设置为1.5。
#4
0
I haven't run into it myself, but I think the doc for ActionBarSherlock
says you need to extend SherlockFragmentActivity
rather than FragmentActivity
. It may not be the problem, but it's a problem.
我自己也没有亲身经历过,但我认为《行动指南》的医生说,你需要做的是延长碎片整理活动,而不是碎片活动。这可能不是问题,但却是个问题。
#1
13
It seems this error occurred because I didn't have this line in the AndroidManifest.xml file, in the <application>
tag:
看起来这个错误发生是因为我在AndroidManifest中没有这一行。xml文件,在 <应用程序> 标签:
<uses-library android:name="com.google.android.maps" />
#2
9
Click here
点击这里
I think it is the same problem at the Build Path-> Configure Build Path -> Order and Export, the "android-support-v4.jar" needs to be checked.
我认为在构建路径->配置构建路径->订单和导出,“android-support-v4”也是同样的问题。jar需要检查。
Hope it is useful to you.
希望它对你有用。
#3
2
Have you set the compiler compliance for the actionbarsherlock library project? Right click on the library project, go to properties. Under java compiler, make sure compliance is set to 1.6. I had a similar issue, and found the compliance set to 1.5.
您是否设置了actionbarsherlock库项目的编译器遵从性?右键点击库项目,进入属性。在java编译器下,确保遵从性设置为1.6。我有一个类似的问题,发现遵从性设置为1.5。
#4
0
I haven't run into it myself, but I think the doc for ActionBarSherlock
says you need to extend SherlockFragmentActivity
rather than FragmentActivity
. It may not be the problem, but it's a problem.
我自己也没有亲身经历过,但我认为《行动指南》的医生说,你需要做的是延长碎片整理活动,而不是碎片活动。这可能不是问题,但却是个问题。