4

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

Community
  • 1
  • 1
Ilya Kogan
  • 21,995
  • 15
  • 85
  • 141
  • Have you declared your StopSelection Activity in your Manifest? – zennon May 24 '13 at 13:50
  • If activities are not declared in the manifest it throws a ActivityNotFoundException as compared to the ClassNotFoundException. This is definitely a build error. Check my answer below to provide proper build settings to your app. – Sam May 24 '13 at 15:11

3 Answers3

14

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:

  1. Make sure your ABS lib project is marked as a Library. Properties -> Android -> Check "Is Library"
  2. 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.
  3. 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.

Sam
  • 3,413
  • 1
  • 18
  • 20
  • Thank you for your valid points, but unfortunately that's not it. Everything you mentioned looks ok. – Ilya Kogan May 24 '13 at 20:44
  • 2
    Turns out I still had actionbarsherlock in Java Build Path -> Projects. I removed it, then added using Android -> Library -> Add, and the error message in the console stopped! I still have a ClassNotFoundException, but this is probably unrelated. – Ilya Kogan May 24 '13 at 21:18
  • thats true. it had persisted a little bit for me. i also removed it from Properties->Java Build Path->Projects(tab) and made sure "Android Private Libraries" was checked under "Order and Export" in the same location – mugume david May 28 '13 at 09:50
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..

zennon
  • 1,080
  • 10
  • 25
  • I removed it and added it again, but it doesn't help. – Ilya Kogan May 24 '13 at 20:44
  • Turns out I didn't remove it altogether, so I double-checked and it turned out I still had actionbarsherlock in Java Build Path -> Projects (see my comment on Samarath's answer). – Ilya Kogan May 24 '13 at 21:19
  • Thank you.. I coupled your advise with the advise from Samarth Jain.. I was not importing Sherlock Library correctly! – jheneghan Jul 10 '13 at 12:29
0
  1. Remove actionbar sherlock project folder from PropertiesJava Build PathProjects (tab) of your host project and

  2. make sure Android Private Libraries was checked under Order and Export in the same location of my own project which uses action bar sherlock as library project - and it works.

Armali
  • 18,255
  • 14
  • 57
  • 171
sud
  • 505
  • 1
  • 4
  • 12