sqlite-jdbc icon indicating copy to clipboard operation
sqlite-jdbc copied to clipboard

Allow correct recognition of Android OS when running Termux environment

Open arch-dev opened this issue 3 years ago • 6 comments

If isAndroid() check fails, checkIfAndroidTermux() is called which runs uname -o command and check if its output contains android. This should fix #789.

Sample command output in Termux before changes: Screenshot_20221016-120121.png

Sample command output in Termux after changes: Screenshot_20221016-120404.png

arch-dev avatar Oct 16 '22 09:10 arch-dev

why did you change some of the native libraries ?

gotson avatar Oct 17 '22 01:10 gotson

when running java within Termux, is it using a different Java runtime that when running a normal Android app ? What is the result of System.getProperty("java.runtime.name", "") within Termux ?

gotson avatar Oct 17 '22 02:10 gotson

Here's the output: Screenshot_20221017-090813.png

arch-dev avatar Oct 17 '22 07:10 arch-dev

While working on #797 i am actually not sure how Termux works on Android.

  • it seems to be a JDK from eclipse, but not specific to Android?
  • however the native library needs to have been compiled with the NDK for it to work
  • that bit is apparently not triggered though, and the classic loader is used

Would you be able to check the value of the property java.vm.vendor also ?

gotson avatar Oct 17 '22 08:10 gotson

Here you are: Screenshot_20221017-120304.png

Note: to install Java on Termux you run pkg install openjdk-x where x is the jdk version you need. Regarding openjdk-17 it is grabbed through Termux pkg management system: https://github.com/termux/termux-packages/blob/master/packages/openjdk-17/build.sh

arch-dev avatar Oct 17 '22 10:10 arch-dev

Thanks, that confirm my understanding.

gotson avatar Oct 17 '22 10:10 gotson

This still requires some work @arch-dev as there are conflicts, and the native libs should not have been changed. Is that something you're still working on?

gotson avatar Nov 17 '22 06:11 gotson

Reworked and used available ProcessRunner class.

arch-dev avatar Nov 22 '22 14:11 arch-dev

@arch-dev i have refactored the code slightly and added some tests, please have a look and let me know if that's fine with you

gotson avatar Nov 23 '22 04:11 gotson

Yes good idea separing checks. Tested and it works without problems.

arch-dev avatar Nov 23 '22 20:11 arch-dev