Spotify API crashing because of Library issue - android

I had been working with the SpotifyAPI for a long time, but randomly it just started to crash on me whenever it trys to load the player. Here is the error I get
12-22 20:20:01.995 28130-28130/com.skyrealm.brockyy.spotifyapi E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.skyrealm.brockyy.spotifyapi-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libgnustl_shared.so"
The line of code that I get this error in is
Spotify.getPlayer(playerConfig, this, new Player.InitializationObserver() {
Thank you for your time!
- Rockyfish

I think you might have just hit the 64k method limit
This is when the amount of code you have (including libraries) is more than Android usually packs into a dex file aka your apk. There is a solution
Try this to resolve the solution:
http://developer.android.com/tools/building/multidex.html
fyi it's sad when you hit this limit :-( and usually there is usused code in your project that could do with pruning to tidy it up (including unused library code).
The other possibility is you're writie native (NDK) code, and I can't help you so much with that :)

Related

Dexguard crashing after library added with native code

After adding a library to project that contains native code (embedded as .so), my app build started to crash when running the dexguard<Flavor><BuildType> task.
The error says:
Caused by: java.io.IOException: Can't read [/home/user/project/app/build/intermediates/transforms/mergeJniLibs/flavor/buildType/folders/2000/1f/main(;;;;;;lib/*/*.so,lib/*/gdb*)] (Can't write resource [lib/x86/filecointainedonlibrary.so] (New string section exceeds the length of the original: 243 > 242))
That might happen when DexGuard obfuscates your native methods.
The latest version 7.1.29 should fix this issue, please give it a try.
Edit: The troubleshooting section of the DexGuard manual describes work-arounds when this happens. They basically keep names of native methods.

java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null

I am working with CsipSimple and try to create an account in local network...the build runs fine....but i can't make my account active....at the beginning of the project run it catches an exception java.lang.UnsatisfiedLinkError.......and it says unable to load native library...I have been searching all day long...i created armeabi-v7a under lib folder....and I have downloaded two .so file from firefox nightly build as descripted in this link.... here but i have same problem....please help me with this
Thrown when an attempt is made to invoke a native for which an implementation could not be found.
http://developer.android.com/reference/java/lang/UnsatisfiedLinkError.html
Please check this link https://stackoverflow.com/a/22121375/1761003
Please do post some code for better reply

Native application crashes on Android L

I have a native application that always worked on Android KitKat with both Dalivik and ART runtimes, but it now crashes on Android L with the following trace:
E/art(12810): dlopen("/data/app-lib/com.mylib.example", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
D/AndroidRuntime(12810): Shutting down VM
E/AndroidRuntime(12810): FATAL EXCEPTION: main
E/AndroidRuntime(12810): Process: com.mylib.example, PID: 12810
E/AndroidRuntime(12810): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
E/AndroidRuntime(12810): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(12810): at java.lang.System.loadLibrary(System.java:610)
Is ART runtime in Android L different from KitKat? There is no new NDK available yet, therefore, how to avoid this crash, because it seems that the function issetugid is no longer supported.
The issue has been fixed in the final Android 5.0 release. There is no need to re-compile existing binaries.
However, if the native lib is compiled with target android-21, it fails on previous Android versions (< 5.0)
I think i may have the answer, please correct me if iam wrong.I had faced similar issue and now its fixed (or i have found a workaround rather)
while registering native method to JNI, there are two ways of doing it.
1) Implement JNI_OnLoad() method in your .cpp file and register your native methods with the
appropriate classes.
Check- http://developer.android.com/training/articles/perf-jni.html#native_libraries
example - https://android.googlesource.com/platform/development/+/master/samples/SimpleJNI/jni/native.cpp
2) there is a particular naming convention to follow for the native methods, where the class path (including package) have to be added.
Check - http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615
Here we need not implement any method. The JVM discovers the native method from the symbol names it self from the binary.
The first method doesn't seem to work in Android ART runtime (ART is Optional in kitkat and it will be the only runtime in Lolipop).I am not not sure why it doesnt work. but i think the reason is because the way ART performs.(The bytecodes are converted and cached during install time itself instead of runtime, so that app runs faster). So since the native libs are not loaded (on_load is not called) the conversion to machine code fails at some point
Use the second method to register natives. it should work.
Only disadvantage is now your function names will be and long and will look horrible (i bet none of the function will fit in 100char limit).bye bye function name readability.
Hope this helps
Cheers,
Shrish

Unsatisfied link error for native library

I developed applications which use native code. All of a sudden those are not working, giving error "Unsatisfied link error: Couldn't load native library from loader dalvik.System.pathClassLoader, findLibrary returned null. I restarted adt twice. Still getting the same error. Applications which are not using native code, are working fine.
The error implies that the program is not able to find the shared libraries that you would have created.
Which devices did you try it on ?
You can check once if they are available in libs directory of your app . [/data/data/app_id/lib ]. Also check if armv7 support is required and if the directory is there in the libs , is .so present there.
Now it's working. I deleted all my virtual devices and then created a new one. However it's showing "skipped 264 frames. application may be doing too much work on main thread" many times and whenever we press a button, displaying this message in log "error loading /system/media/audio/ui/Effect_Tick.ogg"
thanks.

jni problems when system load the .so file

I have already created .so file and put it in proper path.
However,when I try to run the android program the problem came by.
the problem is:
`5-16 15:34:16.704: E/AndroidRuntime(9968): Caused by: java.lang.UnsatisfiedLinkError:
Cannot load library: reloc_library[1311]: 1584 cannot locate '_Z13raptor_decodePKhtPKtPhjPK15RaptorParam_tag'...
raptor_decode is a function which included by the jni_function.`
what should i do to correct this problem? Thanks.
I think here is your problem:
1584 cannot locate '_Z13raptor_decodePKhtPKtPhjPK15RaptorParam_tag'
if raptor_decode is the method you want to call, read up here: http://java.sun.com/docs/books/jni/html/design.html (and read up 11.3)

Categories

Resources