abcore
abcore copied to clipboard
Android 10 won't allow executing binaries in app home directory
In Android 10, files in the app home directory no longer have execute permission, which means ABCore can't execute the tor
and bitcoind
binaries that were downloaded and extracted there.
For now we can change ABCore to target Android 9 (API level 28) to get around this, but this means we can't use new Android 10 features if we'll want to. Also, eventually apps targeting level 28 won't be allowed in the store. So need to start thinking about a solution.
Google recommends including binaries in the APK (the Play Store can choose the correct version based on the device architecture). Not sure about F-Droid..
Including the binaries will help for one more version but Google plans to remove exec() entirely.
At that point we need core as a library.
Termux also seems to be discussing this issue https://github.com/termux/termux-app/issues/1072
As udi said, including the binary in the APK should work for now but im interested in the the plans to remove exec() , is there a link to where this is stated?,
At that point we need core as a library
you mean we can have a Java wrapper around the bitcoind binary and import it as a java lib?
Java wrapper is secondary but rather than starting a new process we load the library in process and start the main function in a thread. In Green Wallet we do that for Tor already. But core will need a lot of work to handle restart in this way (static initializers need to rerun each restart)
Perhaps using btcd as a library is easier..
For the tor part what about using orbot? Instead of duplicatimg tor instance on the device?
So I think I may have found the solution for os 10 at least, I havent fully tested it but I at least got the tor exec running on my android device targeted at api 29
Basically you can place the executables in the resources/lib/ARCH folder
then you run that with Runtime.getRuntime().exec(execPath)
As its a readonly directory android allows it to run
note I could get it to run with process builder so had to use exec()
There is also no need to download the executable for the arch as the lib directory lets you create directories specific to the arc
References https://stackoverflow.com/a/62730836/4144699 https://stackoverflow.com/a/58748468/4144699
For the tor part what about using orbot? Instead of duplicatimg tor instance on the device?
I guess because it requires the user to install another app and orbot can be iffy
@greenaddress Including the binaries will help for one more version but Google plans to remove exec() entirely.
Is this documented any where?
Here is solution to this problem 2022 Android 11, and no root needed. https://stackoverflow.com/a/72917882
Unfortunately not @Hex2424, that's what Lawrence explained here. To load core as a static library requires a lot of work in the main project.
Java wrapper is secondary but rather than starting a new process we load the library in process and start the main function in a thread. In Green Wallet we do that for Tor already. But core will need a lot of work to handle restart in this way (static initializers need to rerun each restart)