Classnotfound exception even when there is class declared - android

My app runs fine when i run it through eclipse, but when i export it and then install it through adb install and run, it crashes with following stacktrace.
basically, it says that main launcher activity not found, although it is declared, and is set to main activity with launcher category:
Stacktrace:
01-24 11:50:59.029: E/AndroidRuntime(7768): Uncaught handler: thread main exiting due to uncaught exception
01-24 11:50:59.299: E/AndroidRuntime(7768): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nitinbansal85.android.carplexindia/com.nitinbansal85.android.carplexindia.ActivityDashboard}: java.lang.ClassNotFoundException: com.nitinbansal85.android.carplexindia.ActivityDashboard in loader dalvik.system.PathClassLoader#32518de0
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2474)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2569)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread.access$2200(ActivityThread.java:125)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.os.Handler.dispatchMessage(Handler.java:99)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.os.Looper.loop(Looper.java:123)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread.main(ActivityThread.java:4420)
01-24 11:50:59.299: E/AndroidRuntime(7768): at java.lang.reflect.Method.invokeNative(Native Method)
01-24 11:50:59.299: E/AndroidRuntime(7768): at java.lang.reflect.Method.invoke(Method.java:521)
01-24 11:50:59.299: E/AndroidRuntime(7768): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
01-24 11:50:59.299: E/AndroidRuntime(7768): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
01-24 11:50:59.299: E/AndroidRuntime(7768): at dalvik.system.NativeStart.main(Native Method)
01-24 11:50:59.299: E/AndroidRuntime(7768): Caused by: java.lang.ClassNotFoundException: com.nitinbansal85.android.carplexindia.ActivityDashboard in loader dalvik.system.PathClassLoader#32518de0
01-24 11:50:59.299: E/AndroidRuntime(7768): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-24 11:50:59.299: E/AndroidRuntime(7768): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-24 11:50:59.299: E/AndroidRuntime(7768): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-24 11:50:59.299: E/AndroidRuntime(7768): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
01-24 11:50:59.299: E/AndroidRuntime(7768): ... 11 more
01-24 11:51:01.369: E/msm7k.gralloc(1281): [unregister] handle 0x43bf20 still locked (state=40000001)
Im also using facebook sdk, and airpush and startApp sdk's, and have included them in order import/export
Any suggestions whats going wrong?
thanx in advance
EDIT
Forget to mention that i had renamed my project and folder that contained it.

For an android app, I'd same issue with an external jar file. In my case the solution was to move the jar from "lib" folder to the android default "libs" folder.
When the jar was in lib folder (was added to build path as well), while there are was no build issue in Eclipse, the app was giving ClassNotFoundException at runtime. Once I moved the jar to "libs" folder, the jar started appearing under "Android Dependencies" and app started working fine.
These are some of the other discussions about the same topic.
1)http://stackoverflow.com/questions/3642928/adding-a-library-jar-to-an-eclipse- android-project
2)http://stackoverflow.com/questions/7185488/android-what-is-the-folder-name-of-the-jar-files-lib-or-libs
3)http://stackoverflow.com/questions/2611105/how-to-specify-lib-folder-for-jars-when-using-android-generated-ant-build-file
may this could help...!!!!!

As the Stacktrace tells that android first starts the NewActivity -> LoadClass -> FindClass -> ClassNotFoundException, could be:
wrong package declaration in Manifest(com.nitinbansal85.android.carplexindia.ActivityDashboard)
Android Debug Bridge(ADB) apk creation problem.
Failed to load other jars from libs
You can also try compiling the project from eclipse and use .apk directly from bin directory of your project and check the difference.

Related

FFmpegMediaPlayer: findLibrary returned null

I use https://github.com/wseemann/FFmpegMediaPlayer in my application, but some Android device throw exception:
java.lang.ExceptionInInitializerError
at ru.mypackage.PlayService.initPlayer(PlayService.java:74)
at ru.mypackage.PlayService.onCreate(PlayService.java:68)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:1949)
at android.app.ActivityThread.access$2500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
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:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load avutil: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:429)
at java.lang.System.loadLibrary(System.java:554)
at wseemann.media.FFmpegMediaPlayer.<clinit>(FFmpegMediaPlayer.java:620)
... 13 more
My project:
Can somebody explain me what's wrong there?
On my device and some other device the app working nice, but on some device (for example: Galaxy Ace (GT-S5830i) Android 2.3.3 - 2.3.7) it throw the exception.
p.s. about "lib" prefix I understood ( https://developer.android.com/reference/java/lang/System.html#mapLibraryName(java.lang.String) )
You have to place the armeabi file under jnilibs folder (you will have to create it) in app/src/main/.
Hope it helps.

Good dynamics fatal exception from sample app

Has anyone encountered this error while trying to use Good Dynamics sample applications from their SDK?
It has me stumped as i have included the what should be all the necessary files
01-24 06:28:21.463: E/AndroidRuntime(1436): FATAL EXCEPTION: main
01-24 06:28:21.463: E/AndroidRuntime(1436): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.good.gd.example.policy/com.good.gd.example.policy.ApplicationPolicy}: java.lang.ClassNotFoundException: Didn't find class "com.good.gd.example.policy.ApplicationPolicy" on path: DexPathList[[zip file "/data/app/com.good.gd.example.policy-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.good.gd.example.policy-2, /vendor/lib, /system/lib]]
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.os.Handler.dispatchMessage(Handler.java:99)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.os.Looper.loop(Looper.java:137)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread.main(ActivityThread.java:5103)
01-24 06:28:21.463: E/AndroidRuntime(1436): at java.lang.reflect.Method.invokeNative(Native Method)
01-24 06:28:21.463: E/AndroidRuntime(1436): at java.lang.reflect.Method.invoke(Method.java:525)
01-24 06:28:21.463: E/AndroidRuntime(1436): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-24 06:28:21.463: E/AndroidRuntime(1436): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-24 06:28:21.463: E/AndroidRuntime(1436): at dalvik.system.NativeStart.main(Native Method)
01-24 06:28:21.463: E/AndroidRuntime(1436): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.good.gd.example.policy.ApplicationPolicy" on path: DexPathList[[zip file "/data/app/com.good.gd.example.policy-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.good.gd.example.policy-2, /vendor/lib, /system/lib]]
01-24 06:28:21.463: E/AndroidRuntime(1436): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
01-24 06:28:21.463: E/AndroidRuntime(1436): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-24 06:28:21.463: E/AndroidRuntime(1436): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
01-24 06:28:21.463: E/AndroidRuntime(1436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
01-24 06:28:21.463: E/AndroidRuntime(1436): ... 11 more
Yeah, first you need to import project from good sdk folder in extras folder of Android SDK folder, then in gd folder...import the project in workspace, then whenevr you try to run any app on Good Technology, create dependency on that imported project. then you dont get exception. Hope this helps you.

android error java.lang.NoClassDefFoundError

I have android app in market so I get this error but I don't know why.
Exception class java.lang.NoClassDefFoundError
Source method MainActivity.onCreate()
java.lang.NoClassDefFoundError: android.app.DownloadManager
at com.example.viewpagerexample.MainActivity.onCreate(MainActivity.java:182)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
DownloadManager was added on API level 9 (aka Gingerbread).
My guess you declared minSDK as lower than 9 in your AndroidManifest.xml
If that is the case, you need to devise a workaround for users using older Android version.
You can check on which version your app is running by using the following code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// Use DownloadManager
}
else {
// Workaround
}

MonoDevelop default M4A application "has stopped unexpectedly"

When I try running the default "Mono for Android Application", I get an error that the application has stopped unexpectedly.
After, (sometimes) I would get an exception in MonoDevelop: System.IO.IOException: DWP Handshake failed.
I'm not sure what could be wrong - I haven't made any changes to the application. Any help would be greatly appreciated - I've been trying to get this running all day.
TIA
Stacktrace:
D/AndroidRuntime( 2066): Shutting down VM
E/AndroidRuntime( 2066): FATAL EXCEPTION: main
E/AndroidRuntime( 2066): java.lang.UnsatisfiedLinkError: Couldn't load monodroid: findLibrary returned null
E/AndroidRuntime( 2066): at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime( 2066): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime( 2066): at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:24)
E/AndroidRuntime( 2066): at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:25)
E/AndroidRuntime( 2066): at android.app.ActivityThread.installProvider(ActivityThread.java:3554)
E/AndroidRuntime( 2066): at android.app.ActivityThread.installContentProviders(ActivityThread.java:3309)
E/AndroidRuntime( 2066): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3265)
E/AndroidRuntime( 2066): at android.app.ActivityThread.access$2200(ActivityThread.java:117)
E/AndroidRuntime( 2066): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
E/AndroidRuntime( 2066): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2066): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2066): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 2066): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2066): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 2066): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 2066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 2066): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2066): Sending signal. PID: 2066 SIG: 9
I had a similar problem not long after going with the paid version. Simply clean and rebuild to update the references to the new monodroid library.
See also: http://www.mail-archive.com/monodroid#lists.ximian.com/msg00531.html
This is very probably Android bug 21670: sometimes native libraries are not extracted from the .apk, but the installation is still reported as successful:
W/NativeHelper( 98): Failed to cache package shared libs
W/NativeHelper( 98): java.io.IOException: Couldn't create cached binary /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so in /data/data/Mono.Android.DebugRuntime/lib
W/NativeHelper( 98): at com.android.internal.content.NativeLibraryHelper.copyNativeBinaryLI(NativeLibraryHelper.java:289)
Check your Android Debug Logs for a message similar to the above to confirm that this is the case.
If you see the above, you need to uninstall your app and as many other packages as possible to free up storage space, then reinstall your app.

Android and slf4j : "java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory"

Two days ago, when my android project in eclipse still worked, I added "android SDK 4.0.3" to my SDKs (in addition to android SDK 2.1).
From that moment on, I have a trouble with slf4j-android library; here's the exception:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1479)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at it.cefriel.swa.urbanopoly.client.game.UrbanopolyActivity.<clinit>(UrbanopolyActivity.java:11)
The JAR I use is slf4j-android-1.5.8.jar. The build path seems correctly setted. I also tried to create another project using slf4j and I got the same error..
Any Ideas?
Thanks in advance
Try adding the slf4j-api-1.5.8.jar or latest version as well with the current slf4j-android-1.5.8.jar

Categories

Resources