I uploaded an app to the playstore. The app contains native C code. I compiled it successfully using NDK, created the signed apk. I also installed the signed apk and checked. Everything worked fine.
After uploading it I downloaded it from playstore and it crashed.
Following is the stack trace:
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load hello-jni: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at com.somepackage.anotherpackage.SomeActivity.<clinit>(SomeActivity.java:56)
... 15 more
The error states that System.loadLibrary returned null. But the same code when run using eclipse works fine.
Thanks for any help
Seems like your apk is missing libhello-jni.so. Maybe it was not packaged during apk build.
If you open your apk with a zip software, you should have a folder libs containing libhello-jni.so : if you don't have it, then you forgot something at build time.
Related
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.
Facebook apk delivered with sdk 4.1.0 doesn't not work in emulators where it supposed to work(sdk emulator and genymotion)
It always crashes with the same exception
05-08 08:42:42.022 3279-3279/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: could find DSO to load: libbreakpad.so
at com.facebook.soloader.SoLoader.a(SoLoader.java:179)
at com.facebook.soloader.SoLoader.a(SoLoader.java:144)
at com.facebook.breakpad.BreakpadManager.a(BreakpadManager.java:55)
at com.facebook.breakpad.BreakpadManager.b(BreakpadManager.java:78)
at com.facebook.breakpad.BreakpadManager.a(BreakpadManager.java:82)
at com.facebook.katana.app.FacebookApplication.b(FacebookApplication.java:169)
at com.facebook.base.app.DelegatingApplication.attachBaseContext(DelegatingApplication.java:62)
at android.app.Application.attach(Application.java:146)
at android.app.Instrumentation.newApplication(Instrumentation.java:983)
at android.app.Instrumentation.newApplication(Instrumentation.java:967)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any solution?
Change your avd image from x86 to Arm.
It should work with you now.
I updated an app in goolge play store with a new version.Now if app open then Application class not found exception occurs.
App works fine if the apk install directly .But not from play store.
Crash analytics report says
java.lang.RuntimeException: Unable to instantiate application com.xxx.xx.GetJsonArrayFromChannelUrl: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.GetJsonArrayFromChannelUrl" on path: /data/app/com.xx.xx-2.apk
at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4584)
at android.app.ActivityThread.access$1400(ActivityThread.java:158)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5365)
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.ClassNotFoundException: Didn't find class "com.xxxx.fetchdata.GetJsonArrayFromChannelUrl" on path: /data/app/com.xx.xx-2.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
Follow these steps.
Clean your libraries
Right click on project > Android Tools > Fix Project properties
Project > Clean
My apps are force closing on few devices(samsung & sony) after implementing interstitial ads and the stack traces from developer console is as follows.
java.lang.NullPointerException
at com.google.ads.a.f$a.run(SourceFile:128)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
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:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
I don't understand why it is happening. Can someone help?
Use the new Google Play Services library which now include the Admob classes.
The Admob package has changed so your imports will need to be adjusted to
import com.google.android.gms.ads.*;
I have an android app that was working previously, I had to set up the dev environment on a new PC. Everything compiles fine (i'm using Android Studio), but I get the following error:
11-26 15:25:22.737 15132-15132/com.sample E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gcm.GCMRegistrar
at com.sample.views.loginregistration.LoginManager.handleRegistration(LoginManager.java:147)
at com.sample.views.loginregistration.LoginViewFragment.onCreateView(LoginViewFragment.java:74)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:523)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
It's saying it cannot find gcm.jar which is clearly in the project and in a folder called libs. These were the common issues that people reported in other SO posts. The app basically launches and then crashes on the spot... But i'm confused as the setup is correct.
Is there anything else that could be wrong with this?
It might be a build.gradle issue. You should have this in your build.gradle file
dependencies {
compile files('libs/gcm.jar')
}
Once you've added that, go to Tools -> Android -> Sync Project with Gradle Files