Closed oleksiiborysenko closed 3 years ago
Assuming you've already made sure the original binary is chmod +x
(which could be one cause of the error): I once heard of a method where you place the executable file with the libs project folder - e.g. libs/arm64-v8a
, and name it something like libexecutable.so
(that way it ends up in the apps lib folder, e.g. /data/app/myapp/libs/libexecutable.so
), then you just make sure it's chmod +x filename
and execute it as an executable from the lib folder. That might be the solution here. Not sure whether the symlinks will work in this case, but you can still always use the executable directly.
Does that work for you?
Thank you for the reply!
Regarding chmod
: it has rwx
rights, also it works properly with other SDK versions, so I can assume that it shouldn't be an issue.
Regarding adding lib prefix and .so suffix: as I see all libraries except magick
have this pattern. So I guess the solution for me will be to re-build library with proper naming (libmagick.so). Will try it. I hope I understood you correctly and that's what you meant :)
No need to rebuild. Just rename the magick
binary file to libmagick.so
, put it in the right folder, then execute it like normal as a binary file using the lib path. libmagick.so
in this example is NOT a library, only the renamed binary file. It's done this way so the system will copy it over for us, but in reality it's just the same binary as before. All we're doing is executing it from the lib path instead of the assets folder.
Apparently you can still make symlinks to it like normal. So you could still treat it as a normal magic
binary after symlinking to the "lib".
For more information, see these links. https://stackoverflow.com/questions/64786837/what-path-to-put-executable-to-run-on-android-29 https://github.com/JeromeDeBretagne/erlanglauncher/issues/2#issuecomment-725441170
I've made a new entry in the FAQ on how to solve your issue. Please check the latest entry in the FAQ for more information!
Thanks for links and explanation! Very helpful! You answer faster than I implement your suggestions))
Just decided to confirm: your solution works for the newest version of API! Symlinks also work. So thanks again.
Hello. First of all very appreciate about your work. This project is really helpful.
But while implemented it I faced an issue with running library on target versions that are higher than SDK 28. Maybe you have some suggestions regarding it.
It looks like after 28 version the permission rules become more strict and deny to run libraries directly.
If i want to
convert
image I constantly got an exception like:java.io.IOException: Cannot run program "/data/user/0/com.example.project/files/usr/bin/arm64-v8a/convert": error=13, Permission denied
Any ideas of how it can be fixed for latest versions? Reproduced only with
compileSdkVersion
&targetSdkVersion
higher than 28