java.lang.NoClassDefFoundError for a class in the project - android

Android is throwing NoClassDefFoundError for ~1% of my users, no specific SDK version.
It's happening In my activity in the onCreate function when it try's to get an instance to a Singleton class i have in my project.
The singleton class it self doesn't reference any libs jar.
I tried on same devices it's heppening (e.g. SGH-T989) with no success.
Edit: adding the stack trace
at com.myapp.activities.RootActivity.getLoaderInstance(RootActivity.java:450)
at com.myapp.activities.RootActivity.doOnCreate(RootActivity.java:215)
at com.myapp.android.activities.AbstractActivity.onCreate(AbstractActivity.java:130)
at android.app.Activity.performCreate(Activity.java:5188)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4938)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)

Related

Cannot include FFmpegMediaPlayer lib in my android project

I've to include in my Android studio project a lib for managing audio streams from urls. I'm tying to use this, but when I try to run the app and it reach the point where have to instantiate a FFmpegMediaPlayer object, it crush with the error
31444-31444/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
These the steps I've done to integrate the lib in my project:
I've copied all .so, gdb.setup and gdbserver files from demo project and put them into my jniLibs replicating the exact folder structure
I've copied fmp.jar from demo my libs forlder
I've changed all paths in gdb.setup files accordingly with my project folder structure
synch with gradle
I'm not an expert of Android specially for tasks like this, am I missing something important? If you need it I can give a test app
Thankyou
Edit 1
This is the complete error
08-19 10:20:42.066 31444-31444/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.lucabrognara.radiostreamprova.RadioActivity.onCreate(RadioActivity.java:126)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1892]: 1836 could not load needed library 'libswresample.so' for 'libavcodec.so' (load_library[1094]: Library 'libswresample.so' not found)
at java.lang.Runtime.load(Runtime.java:340)
at java.lang.System.load(System.java:521)
at wseemann.media.FFmpegMediaPlayer.<clinit>(FFmpegMediaPlayer.java:604)
            at com.example.lucabrognara.radiostreamprova.RadioActivity.onCreate(RadioActivity.java:126)
            at android.app.Activity.performCreate(Activity.java:5206)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
            at android.app.ActivityThread.access$700(ActivityThread.java:140)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4921)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
            at dalvik.system.NativeStart.main(Native Method)
Obviously, it was sufficient read carefully the documentation:
If you don't want to build the modules you can simple unzip the prebuilt ones and copy them to your projects "libs" folder
These the right steps:
Create an android studio project
unzip the prebuilt modules in jniLibs folder
put the fmp.jar file in libs folder
obviously include the android.permission.INTERNET in your manifest

Crashlytics NoClassDefFoundError: com.crashlytics.android.answers.Answers

I get a project from other developer to fix minor issues in app, when I'm running my app on device I'm getting an error:
15142-15142/com.etripconcept E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.crashlytics.android.answers.Answers
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:224)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:207)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
at com.etripconcept.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
I'm new in Android development, so it may be stupid question, but Google doesn't say anything about it. I use Android Studio 1.2.2 on Win 8.1

Android Studio seems to build old version of project

I am wondering if this is some bug in Android Studio or I am simply lack od knowladge but straight to the point.
I am writing simple client-server via bluetooth app on android. At some point I encoured following problem:
07-11 18:59:20.553 10364-10364/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not find a method parujUrzadzenia(View) in the activity class com.example.pc.klient_serwerbluetooth.Klient for onClick handler on view class android.widget.Button with id 'button6'
at android.view.View$1.onClick(View.java:3775)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:18190)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:5279)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchMethodException: parujUrzadzenia [class android.view.View]
at java.lang.Class.getConstructorOrMethod(Class.java:460)
at java.lang.Class.getMethod(Class.java:915)
at android.view.View$1.onClick(View.java:3768)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:18190)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:5279)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
07-11 19:34:00.498 449-522/? E/ActivityManager﹕ The package com.example.pc.klient_serwerbluetooth is not found. Failure starting process com.example.pc.klient_serwerbluetooth
For what I understand Android Studio can't find method parujUrzadzenia(View) that is marked in button6's properties as onClick method...the funny thing is i deleted this button in my way of solving this problem.
I can't post picture of my project due to low reputation but like I said. I've deleted the reference to method from .xml and method from .java file and got an error saying that there is no required onClick method. So I deleted this whole button and still got this error.
Any advices will be greatly appreciated.

Android library from maven ExceptionInInitializerError (IntelliJ IDEA 12)

I try to use LanguageTool library http://www.languagetool.org/java-api/ in my android app,
try
{
JLanguageTool langTool = new JLanguageTool(new Polish());
}
catch (IOException e) {}
but I'm getting an error. I added maven library using Modules-->Dependencies-->Add-->library -->from maven.
Everything works, when I test it as console application.
11-07 19:54:35.071: ERROR/AndroidRuntime(2982): FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.orto_test.MyActivity.onCreate(MyActivity.java:35)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.languagetool.JLanguageTool.getBuildDate(JLanguageTool.java:93)
at org.languagetool.JLanguageTool.<clinit>(JLanguageTool.java:77)
... 15 more
Thanks in advance!
According to http://languagetool-user-forum.2306527.n4.nabble.com/ClassDefNotFoundError-org-languagetool-language-AmericanEnglish-td4641443.html Languagtool 2.2 can be used on Android successfully. You might want to contact the languagetool-user-forum if you have trouble in getting things to work.

java.lang.VeriryError encountered

Deat developers.
I have made an application but i encounter the following problem:
Occasionally (not always - some times) i get the following error:
java.lang.VerifyError: com/google/example/games/basegameutils/GameHelper
at com.google.example.games.basegameutils.BaseGameActivity.onCreate(BaseGameActivity.java:103)
at development.nk.games.tanc.MainActivity.onCreate(MainActivity.java:97)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
I have looked after this problem and i read that i have to check all Libraries. I did that but the problem still is there.
The class "GameHelper" is a helper class that i use from google play services.
"MainActivity" is the main Activity my app runs. "MainActivity" extends "BaseGameActivity" which uses the "GameHelper" class.
Thank you in advance.

Categories

Resources