1

Recently I have installed Ubuntu 12.04 in place of my Win7. I use Eclipse Juno / Java7. But when I am trying to Run my application I get the following line of errors although everything is in its place. My Manifest have the right class name. My activity filename is also correct as that of in my manifest. But strange part of it is that this error is only caused on the projects in which I am using ActionBarSherloock. Strange isn't it?

Now the line of errors from my logcat:

08-20 19:31:59.545: E/AndroidRuntime(764): FATAL EXCEPTION: main
08-20 19:31:59.545: E/AndroidRuntime(764): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.android/com.app.android.SplashActivity}: java.lang.ClassNotFoundException: com.app.android.SplashActivity
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.os.Looper.loop(Looper.java:137)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread.main(ActivityThread.java:4424)
08-20 19:31:59.545: E/AndroidRuntime(764):  at java.lang.reflect.Method.invokeNative(Native Method)
08-20 19:31:59.545: E/AndroidRuntime(764):  at java.lang.reflect.Method.invoke(Method.java:511)
08-20 19:31:59.545: E/AndroidRuntime(764):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-20 19:31:59.545: E/AndroidRuntime(764):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-20 19:31:59.545: E/AndroidRuntime(764):  at dalvik.system.NativeStart.main(Native Method)
08-20 19:31:59.545: E/AndroidRuntime(764): Caused by: java.lang.ClassNotFoundException: com.app.android.SplashActivity
08-20 19:31:59.545: E/AndroidRuntime(764):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-20 19:31:59.545: E/AndroidRuntime(764):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-20 19:31:59.545: E/AndroidRuntime(764):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
08-20 19:31:59.545: E/AndroidRuntime(764):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
08-20 19:31:59.545: E/AndroidRuntime(764):  ... 11 more

Also note that my ABS library is fine. No jar dependecy error and or similar kind of errors. In one line, I do not see problem in pre compilation processes. Only RuntimeException is thrown.

Can anyone say what might be a problem?

Debopam Mitra
  • 1,842
  • 4
  • 27
  • 51
  • have you tried "clean project" in eclipse? – Ridcully Aug 20 '12 at 20:16
  • Are you sure this activity is correctly defined in the manifest file(including the correct package)? – ColdFire Aug 20 '12 at 20:17
  • @A.A: Yes everything is in its place. As I told you I tried to run a test project it is saying the same thing. – Debopam Mitra Aug 20 '12 at 20:20
  • @Ridcully: I cleaned it before writing this question. I cleaned it now. The problem remains the same. – Debopam Mitra Aug 20 '12 at 20:23
  • and your `SplashActivity` is in package `com.app.android`? – zapl Aug 20 '12 at 21:14
  • @Debopam because the error you get means that the manifest (or you in an intent) defines that there is an Activity class with that name but it can't be found when it shall be started (via reflection). That is either caused by your class really having a different name / package (would be no compile time error) or something went wrong during building the apk and the class was not added. Is that class part of a library project maybe? The new android tools may have broken something in that case. Also try using Java 6 (the sun one), Android may not work with 7 – zapl Aug 20 '12 at 21:31
  • @zapl Broken! What do you mean by broken? I did exactly the same thing I used to do while I was Using Android in Windows 7 and the same thing I did here too. Ok.. if there is a problem(which I can assure there is none) why would it even run my another demo project. Whereas without ABS my other project works fine. – Debopam Mitra Aug 20 '12 at 21:34
  • Is that the entire exception? Are there any SecurityException listed that mean you need to add more permissions? – djunod Apr 17 '13 at 12:00

3 Answers3

2

Ur catlog says:

java.lang.ClassNotFoundException: com.app.android.SplashActivity

Add Splash Activity to your Android Manifest!

IAmGroot
  • 13,760
  • 18
  • 84
  • 154
  • I am using the same src codes that I used in Windows 7. After changing my OS to Ubuntu I imported everything as it was in Windows. Also I already checked, rechecked my Manifest, as I know this might be a possible solution to my problem. – Debopam Mitra Aug 20 '12 at 20:57
  • triple check :) that error is usually due to missing in manifest. Check the file names. – IAmGroot Aug 20 '12 at 21:02
  • SpashActivity is part of the Android API (see the package), therefore I guess there's just an Activity of yours that - directly or indirectly extends it. No need to put SplashActivity itself into your Manifest File. – Ridcully Aug 21 '12 at 13:18
0

You mention that this app uses ActionBarSherlock. Does your Activity extend SherlockActivity?

Okay, SherlockActivity not the problem. Hmm... Is the version of Support Library linked by your application the exact same one that is used by ActionBarSherlock? (The best way to ensure this is to link the same one that ABS was compiled with.)

Sparky
  • 8,437
  • 1
  • 29
  • 41
0

It also could be a problem with the settings of the files coming from windows - windows uses a weird/different end of lineand end of file - I had problems with this coming from Windows to Mac.


As the above questions state, from the specific errors it has to be a problem with the linking of your SplashActivity. If it is in a sub folder there may be a problem with the / (linux) vs \ windows - it may be worth your time to go into the Manifest.

Go into the activity tab and click on your SplashActivity - from here you should click on the class name and let the auto-detect re-enter the value for you. (I don't have eclipse on this computer so I can't give you exact instructions, maybe someone else can?)

Tyler Wall
  • 3,747
  • 7
  • 37
  • 52