abcore icon indicating copy to clipboard operation
abcore copied to clipboard

Android 10 won't allow executing binaries in app home directory

Open udiWertheimer opened this issue 5 years ago • 10 comments

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..

udiWertheimer avatar Oct 06 '19 23:10 udiWertheimer

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.

greenaddress avatar Oct 14 '19 00:10 greenaddress

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?

mandelmonkey avatar Oct 15 '19 17:10 mandelmonkey

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)

greenaddress avatar Oct 16 '19 12:10 greenaddress

Perhaps using btcd as a library is easier..

yaslama avatar Oct 27 '19 08:10 yaslama

For the tor part what about using orbot? Instead of duplicatimg tor instance on the device?

AreYouLoco avatar Nov 15 '19 19:11 AreYouLoco

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

mandelmonkey avatar Aug 12 '20 22:08 mandelmonkey

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

mandelmonkey avatar Aug 12 '20 22:08 mandelmonkey

@greenaddress Including the binaries will help for one more version but Google plans to remove exec() entirely.

Is this documented any where?

mandelmonkey avatar Aug 13 '20 13:08 mandelmonkey

Here is solution to this problem 2022 Android 11, and no root needed. https://stackoverflow.com/a/72917882

Hex2424 avatar Jul 08 '22 23:07 Hex2424

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)

caiofaustino avatar Jul 10 '22 18:07 caiofaustino