jni problems when system load the .so file - android

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)

Related

How to get access to system .so libraries un android

I want to write fm radio for my phone. I decompiled it,and noticed,what it use libfmjni.so,which i found in system folder. But when i try to use it,i get exception:
java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libfmjni.so" needed or dlopened by "/system/lib/libnativeloader.so" is not accessible for the namespace "classloader-namespace"
I tryed to load it in jni\armeAbe folder,but i have the same effect. My phone is rooted. Also i not understand,why in decompiled app (i did the same),it load fmjni instead of libfmjni. Thanks everybody for any help.

Any library to read mdict *.MDX files in android?

I have a .mdx file that infact is a dictionary database (some android apps like bluedict can read its data).
I have used Daemon.tools but it could not open it.
I was looking for any library or sources which helps me to read MDX dictionary files in Java, I have found some resources already such as KnIfER/mdict-java but it does not work in Android Studio (it has errors on accumulation_blockId_tree.xxing(new myCpr(position,1)).getKey().value line and it is connot resolve symbol 'value'). Does any one knows a good source about these files and possible libraries which could be used for it?.
Well, actually this is my java project.
the error mentioned is just a problem of jdk version. you can add <> parentheses after myCpr and convert return of xxing to type myCpr<Integer,Integer> .
But now, I have very much reduced usage of rbtree and use more binary list searching.have a look there.

Spotify API crashing because of Library issue

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 :)

Android ORMLite DatabaseConfigUtil and library project

I am trying to create a Library project for andorid and I am using ORMLite.
Within my library project I have created ormlite_config.txt within the res/raw folder. However, when I make a jar of the library project, it gets sealed. So I get the following error.
java.alang.RuntimeException: Unable to start activity [activityName]: java.lang.IllegalStateException: Could not load object config file
Caused by: java.sql.SQLException: DatabaseTableConfig reading from stream cannot parse line: [random characters]
I have thought about using app specific config file stored on device and reading that. But with that is that I cannot get the application context when I run the DatabaseConfigUtility.
Has anyone ran into this problem before? Your help will be much appreciated!
in the class where you are extending OrmLiteSqliteOpenHelper you might be creating a constructor where you would call super class constructor just pass NULL in place of your "R.raw.ormlite_config", the ormlite_config file in my raw folder didn't contain any code , I had the EXACT SAME problem and this solved it for me. Hope this helps you.

How to load android libraries when running binary files?

So, I have this executable binary file that references some libraries. When I try to run it with runtime.exec(), it gives me an error on the error stream saying:
link_image[1891]: 7176 could not load needed library 'XXX.so' for 'YYY' (load_library[1093]: Library 'XXX.so' not found)CANNOT LINK EXECUTABLE
I have the XXX.so library but I have no idea where I should place it relative to the binary YYY. I want this to work for unrooted device.
Btw, I'm not very good with the building stuff in general, so if you think there's something wrong I did when I built the binary, feel free to point that out.
You have two choices
build this binary with -static flag, I think this is the best way
you can use dlopen to load this library dynamicly, such as
void *g_handle = NULL;
g_handle = dlopen("/system/lib/libskia.so", RTLD_LAZY);
_skFT_Init_FreeType = dlsym(g_handle, "FT_Init_FreeType");
/**do something */
dlclose(g_handle);
Please see https://stackoverflow.com/a/12934668 where yours truly proposed wrapper to set LD_LIBRARY_PATH in a generic way. You can use ProcessBuilder with modified environment, too. See https://stackoverflow.com/a/8962189/192373.

Categories

Resources