I managed to fix the previous linking problem I had with NDK which was caused by android api 21, and managed to get SDL_TTF built and working easily, but with SDL_Mixer I bumped into another runtime Unsatisfiedlinkererror where the app somehow can't link smpeg2 lib with SDL2_Mixer. This time I don't see how it could have anything to do with api-level and have tried everything I could come up with, gone through every makefile and triple-checked every version.
I am using SDL_Mixer 2.0.0 and smpeg2-2.0.0 as its only dependecy. Smpeg2 is located in jni/ folder and the whole thing is built without compiler coughing.
I downloaded SDL_Mixer 2.0.0 source and put it in jni/ folder, copied smpeg2-2.0.0 from it's external/ folder to jni/ and set from mixer makefile to build only smpeg2. I edited src/Android.mk to see the mixer source and get the shared lib and then edited SDLActivity to pull SDL2_mixer library. SDL_TTF worked this way.
libsmpeg2.so DOES exist in libs/ folder so I don't see how it can't find it.
I am using android-19 as build target for NDK, no warnings or errors are given by the compiler.
01-22 18:17:43.760: D/dalvikvm(22101): Trying to load lib /data/data/com.kebabkeisari.peli/lib/libSDL2.so 0x41d88e78
01-22 18:17:43.760: D/dalvikvm(22101): Added shared lib /data/data/com.kebabkeisari.peli/lib/libSDL2.so 0x41d88e78
01-22 18:17:43.760: D/dalvikvm(22101): Trying to load lib /data/data/com.kebabkeisari.peli/lib/libSDL2_mixer.so 0x41d88e78
01-22 18:17:43.765: W/dalvikvm(22101): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/libsdl/app/SDLActivity;
01-22 18:17:43.765: W/dalvikvm(22101): Class init failed in newInstance call (Lcom/kebabkeisari/peli/Ribale;)
01-22 18:17:43.765: D/AndroidRuntime(22101): Shutting down VM
01-22 18:17:43.765: W/dalvikvm(22101): threadid=1: thread exiting with uncaught exception (group=0x410c52a0)
01-22 18:17:43.765: E/AndroidRuntime(22101): FATAL EXCEPTION: main
01-22 18:17:43.765: E/AndroidRuntime(22101): java.lang.ExceptionInInitializerError
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Class.newInstanceImpl(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Class.newInstance(Class.java:1319)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.os.Handler.dispatchMessage(Handler.java:99)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.os.Looper.loop(Looper.java:137)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.reflect.Method.invokeNative(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.reflect.Method.invoke(Method.java:511)
01-22 18:17:43.765: E/AndroidRuntime(22101): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-22 18:17:43.765: E/AndroidRuntime(22101): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-22 18:17:43.765: E/AndroidRuntime(22101): at dalvik.system.NativeStart.main(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1892]: 1952 could not load needed library 'libsmpeg2.so' for 'libSDL2_mixer.so' (load_library[1094]: Library 'libsmpeg2.so' not found)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Runtime.loadLibrary(Runtime.java:370)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.System.loadLibrary(System.java:535)
01-22 18:17:43.765: E/AndroidRuntime(22101): at org.libsdl.app.SDLActivity.<clinit>(SDLActivity.java:51)
01-22 18:17:43.765: E/AndroidRuntime(22101): ... 15 more
You need to load the libraries in reverse dependency order. That is, if libSDL2_mixer.so depends on libsmpeg2.so, you first need to load libsmpeg2.so before you can try to load libSDL2_mixer.so.
That is, in order to load the library, you need to do this:
System.loadLibrary("smpeg2");
System.loadLibrary("SDL2_mixer");
IIRC this has been fixed in some very recent version of Android, but in order to have things working on older versions, you need to explicitly load them one at a time.
Related
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
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.
So, my game runs fine on several devices including Samsung Galaxy S4 and the NVIDIA Shield. But on Nexus 7 (and 5 have the symptoms on a colleague's device, but I haven't been able to confirm through the debugger).
The game consists of 14 shared native libraries plus main.so, all written in C++ and they all seem to load fine, except at least one of in house custom built libraries fails the symbol lookup when instantiating a class, but only when running on a Nexus.
One other symptom is that things seem to work fine if I inline the method that fails the symbol lookup in the header file (as opposed to being in the .cpp file). In this case, the failed symbol lookup just moved to other methods defined in the cpp file (I haven't tried moving everything into the header yet).
I have manually checked that the .so actually has the missing symbol, so I am sure the method is there. The missing symbol is in the libinput.so shown as loaded below.
I have pasted the last part of the log including callstack below. Any help would be greatly appreciated. I have looked around, and no questions I could find seemed to share exactly my symptoms..
... < cut out dynamic loads for other libraries similar to the below > ...
06-15 23:42:37.155: D/dalvikvm(11695): Trying to load lib /data/app-lib/com.kotoristudios.MULEReturns-1/libinput.so 0x41e1dd58
06-15 23:42:37.155: D/dalvikvm(11695): Added shared lib /data/app-lib/com.kotoristudios.MULEReturns-1/libinput.so 0x41e1dd58
06-15 23:42:37.155: D/dalvikvm(11695): No JNI_OnLoad found in /data/app-lib/com.kotoristudios.MULEReturns-1/libinput.so 0x41e1dd58, skipping init
... < cut out dynamic loads for other libraries similar to the above > ...
06-15 23:42:37.185: E/dalvikvm(11695): dlopen("/data/app-lib/com.kotoristudios.MULEReturns-1/libmain.so") failed: dlopen failed: cannot locate symbol "_ZN5Input12InputManager13ReceiveEventsERSt6vectorIPNS_5EventESaIS3_EE" referenced by "libmain.so"...
06-15 23:42:37.185: W/dalvikvm(11695): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/kotoristudios/MULEReturns/MULEReturnsActivity;
06-15 23:42:37.185: W/dalvikvm(11695): Class init failed in newInstance call (Lcom/kotoristudios/MULEReturns/MULEReturnsActivity;)
06-15 23:42:37.185: D/AndroidRuntime(11695): Shutting down VM
06-15 23:42:37.185: W/dalvikvm(11695): threadid=1: thread exiting with uncaught exception (group=0x4154bba8)
06-15 23:42:37.185: E/AndroidRuntime(11695): FATAL EXCEPTION: main
06-15 23:42:37.185: E/AndroidRuntime(11695): Process: com.kotoristudios.MULEReturns, PID: 11695
06-15 23:42:37.185: E/AndroidRuntime(11695): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN5Input12InputManager13ReceiveEventsERSt6vectorIPNS_5EventESaIS3_EE" referenced by "libmain.so"...
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.Runtime.loadLibrary(Runtime.java:364)
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.System.loadLibrary(System.java:526)
06-15 23:42:37.185: E/AndroidRuntime(11695): at com.kotoristudios.MULEReturns.MULEReturnsActivity.(MULEReturnsActivity.java:28)
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.Class.newInstanceImpl(Native Method)
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.Class.newInstance(Class.java:1208)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.os.Handler.dispatchMessage(Handler.java:102)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.os.Looper.loop(Looper.java:136)
06-15 23:42:37.185: E/AndroidRuntime(11695): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.reflect.Method.invokeNative(Native Method)
06-15 23:42:37.185: E/AndroidRuntime(11695): at java.lang.reflect.Method.invoke(Method.java:515)
06-15 23:42:37.185: E/AndroidRuntime(11695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-15 23:42:37.185: E/AndroidRuntime(11695): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-15 23:42:37.185: E/AndroidRuntime(11695): at dalvik.system.NativeStart.main(Native Method)
06-15 23:47:37.408: I/Process(11695): Sending signal. PID: 11695 SIG: 9
Decided to use Scandit SDK to get the barcode scanning feature in my app. Unfortunately, since I'm relatively new to Android development and Java in general I've run into a few issues that I can't seem to work out. The demo that Scandit provided doesn't give any errors(runs fine) but crashes when I try to start it up (pressing a button from one activity is meant to start it up). I've tried reading the logcat and googling a solution to the problems but I'm not getting the right solutions. Does anyone have an idea of what I'm doing wrong?
Logcat is provided below:
10-08 23:30:00.807 21563-21563/com.kwesimbia.management D/AndroidRuntime? Shutting down VM
10-08 23:30:00.807 21563-21563/com.kwesimbia.management W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40aa4228)
10-08 23:30:00.817 21563-21563/com.kwesimbia.management E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3082)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.kwesimbia.management.ScanditSDKDemoSimple
at com.kwesimbia.management.Activity_D.initiateCodeScan(Activity_D.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Process: com.kwesimbia.management
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Package: com.kwesimbia.management v1 (1.0)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger?
Application Label: firstapp
10-08 23:30:00.827 32726-587/? W/ActivityManager?
Force finishing activity com.kwesimbia.management/.Activity_D
I came across this problem as well, my solution was to extract the library files and put them as their files in the lib folder
The library basically isn't being exported with it
EDIT
So I checked out my project, basically I did these things:
In the libs folder I have a new folder called armeabi and inside that I have libscanditsdk-android-3.3.1.so
Then in my build path I have also referenced the jar file that they provide:
<classpathentry exported="true" kind="lib" path="C:/GIT/Android/FwayScannerProject/FwayScanner/libs/scanditsdk-barcodepicker-android-3.3.1.jar"/>
I'm trying to test for first time my App on my mobile phone, I already did all the usb driver installation, allow non-market apps to install stuff... and now when I launch I get this error on Eclipse LogCat, I don't know what to do anymore, it's a PhoneGap app by the way:
01-22 12:40:08.534: W/asset(15063): Asset path /data/app/com.example.appprueba-1.apk is neither a directory nor file (type=1).
01-22 12:40:08.542: W/asset(15063): Asset path /data/app/com.example.appprueba-1.apk is neither a directory nor file (type=1).
01-22 12:40:08.542: D/AndroidRuntime(15063): Shutting down VM
01-22 12:40:08.542: W/dalvikvm(15063): threadid=1: thread exiting with uncaught exception (group=0x410aa930)
01-22 12:40:08.550: E/AndroidRuntime(15063): FATAL EXCEPTION: main
01-22 12:40:08.550: E/AndroidRuntime(15063): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.appprueba/com.example.appprueba.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.appprueba.MainActivity" on path: /data/app/com.example.appprueba-1.apk
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.os.Handler.dispatchMessage(Handler.java:99)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.os.Looper.loop(Looper.java:137)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread.main(ActivityThread.java:5039)
01-22 12:40:08.550: E/AndroidRuntime(15063): at java.lang.reflect.Method.invokeNative(Native Method)
01-22 12:40:08.550: E/AndroidRuntime(15063): at java.lang.reflect.Method.invoke(Method.java:511)
01-22 12:40:08.550: E/AndroidRuntime(15063): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-22 12:40:08.550: E/AndroidRuntime(15063): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-22 12:40:08.550: E/AndroidRuntime(15063): at dalvik.system.NativeStart.main(Native Method)
01-22 12:40:08.550: E/AndroidRuntime(15063): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.appprueba.MainActivity" on path: /data/app/com.example.appprueba-1.apk
01-22 12:40:08.550: E/AndroidRuntime(15063): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
01-22 12:40:08.550: E/AndroidRuntime(15063): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-22 12:40:08.550: E/AndroidRuntime(15063): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
01-22 12:40:08.550: E/AndroidRuntime(15063): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
01-22 12:40:08.550: E/AndroidRuntime(15063): ... 11 more
You might have not put everything on its place, review Tutorials and have set everything as it says..
Check docs and implementation on phonegap website as well as cardova website.