问题
I'm trying to run my app on a real device from Eclipse. After adding actionbarsherlock as a reference, I can't get rid of this error: Could not find actionbarsherlock.apk
. Here is the full console output:
[2013-05-24 16:10:14 - MyApp] ------------------------------
[2013-05-24 16:10:14 - MyApp] Android Launch!
[2013-05-24 16:10:14 - MyApp] adb is running normally.
[2013-05-24 16:10:14 - MyApp] Performing com.myapp.activities.StopSelection activity launch
[2013-05-24 16:11:26 - MyApp] Uploading MyApp.apk onto device '0A3AA80D1402500E'
[2013-05-24 16:11:26 - MyApp] Installing MyApp.apk...
[2013-05-24 16:11:33 - MyApp] Success!
[2013-05-24 16:11:34 - actionbarsherlock] Could not find actionbarsherlock.apk!
[2013-05-24 16:11:34 - MyApp] Starting activity com.myApp.activities.StopSelection on device 0A3AA80D1402500E
[2013-05-24 16:11:35 - Tahanot] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.tahanot/.activities.StopSelection }
The activity doesn't really start, and there's an error in LogCat:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myApp/com.myApp.activities.StopSelection}: java.lang.ClassNotFoundException: com.myApp.activities.StopSelection in loader dalvik.system.PathClassLoader[/data/app/com.myApp-2.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
at android.app.ActivityThread.access$1500(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.myApp.activities.StopSelection in loader dalvik.system.PathClassLoader[/data/app/com.myApp-2.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1610)
... 11 more
None of the answers here helps: android launch from eclipse not working properly without error message
回答1:
This can happen if you are not exporting Build Path -> Android Private Libraries from your library project. This is something new that you have to do from ADTv22 and up.
Also from your console output, i see that the app is trying to upload an apk for the library. This can happen if you have not added the library in android properly. So here are a few quick steps:
- Make sure your ABS lib project is marked as a Library. Properties -> Android -> Check "Is Library"
- Make sure that for the ABS lib project, Android Private Libraries is checked in Build Path -> Order and Export. This step is only required for ADTv22 and up.
- In your project add the ABS lib project as a library at Properties -> Android -> Add Library. Do not add the ABS lib project as a project dependency in the Build Path yourself, ADT resolves those as it requires, otherwise it generally throws an error like you see above.
Hope this helps you.
回答2:
I think the problem is that you have add the Library project not correct into your android application project..
You have to the Sherlock library to your Project as below:
Properties -> Android in library section you can now add the Sherlock library
hope this helps..
回答3:
Remove actionbar sherlock project folder from
Properties
→Java Build Path
→Projects
(tab) of your host project andmake sure
Android Private Libraries
was checked underOrder and Export
in the same location of my own project which uses action bar sherlock as library project - and it works.
来源:https://stackoverflow.com/questions/16736452/could-not-find-actionbarsherlock-apk