A bit more work is involved, but still should be faster than full SDK build. You'll need to do backup to get package from device, unpack it (it is zlib compressed tar file), add your new files, pack it back and then restore on device with adb restore command. It can download or upload full backups of applications on device (unless this is disabled in app manifest). I think your package must have enabled debug attribute (in manifest) for run-as to work.Īnother option would be to try to use adb backup command. It's been a while time since I have done this, so I may remember some thing wrongly. Just change to real package name (and "-1" suffix is version number you specified in manifest). Something like this:Īdb shell "cat /data/local/tmp/libgame_lib.so | run-as sh -c 'cat > /data/app/-1/lib/arm/libgame_lib.so chmod 700 /data/app/-1/lib/arm/libgame_lib.so'" so file somewhere (/data/local or sdcard), and then use run-as helper to copy. Then you can do a bit more trickier workaround. But writing files to that location (adb push) still works. but, at runtime the linker cannot find the shared library jnitest.so used by JNIsrc. So, I wrote an NDK binary (JNIsrc.c) included the shared library (jnitest.so) and ran it on Android. For Android.mk: LOCALVENDORMODULE : true. What I want to test is the Android NDK JNI called in the following order: C (NDK binary) -> java -> C (shared library). And I believe Android v5 have changed /data/local/tmp - it also doesn't allow dlopen from that location. If the system library which you are using, is built from your own code then you can make the system library as vendor compatible by adding the below flags in either Android.mk or Android.bp. It can happen that vendors like Samsung have modified Android and dlopen will still fail. Typically everybody can write to these locations and dlopen allows to load shared libraries from this place. so file to /data/local (if you are = Android v4) location. Doing these last 3 steps manually instead of using SDK build tools will be significantly faster.Īnother option is to try to put. Then put this library inside apk file (which is just an zip file), run zipalign and do debug code signing. You need to run just the ndk-build to get shared library. First of all you don't need to do full apk build process. That's an security issue so Android doesn't allow that. Yeah loading executable code from sdcard (internal or external) won't work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |