Termux API doesn't work on Android O
I get
cmd: Can't find service: acitivity
for the following commands:
termux-battery-status
termux-clipboard-get
termux-clipboard-set
termux-camera-info
termux-contact-list
I have installed Termux API and I am running Android 8.0.0 Build number OPP4.170623.014 on Google Pixel C.
I have the same issues with Nexus 5X running Android 8.0.0 build number OPR6.170623.013. All the commands from the termux-api package fail with the same message. I tried uninstalling and reinstalling Termux::API, but to no avail.
Same issue with Android O installed on Nexus 6p
Hm, seems that calling am does not work at all on Android 8.0?
The script /system/bin/am in Android 8.0 is:
if [ "$1" != "instrument" ] ; then
cmd activity "$@"
else
base=/system
export CLASSPATH=$base/framework/am.jar
exec app_process $base/bin com.android.commands.am.Am "$@"
fi
In Android 7.0 it was:
base=/system
export CLASSPATH=$base/framework/am.jar
exec app_process $base/bin com.android.commands.am.Am "$@"
Wouldn't it be simpler to simply integrate Termux::API into the main Termux app? What are the benefits of having Termux::API as a seperate app?
@eladts there are many benefits to keep Termux::API as an Addon.
- Permission issues
- Modularity I can probably think of more. Please keep addons separate @fornwall
Addon suggestion: integrating https://github.com/svn2github/ghostcommander as a Termux Addon. This would open up $HOME and similar from the Android interface.
Right, the main reason for keeping the API package separate is that it needs a lot of permissions, which is nice to avoid requiring in the base app.
I got the api to (seemingly) work on a rooted Pixel XL by modifying /data/data/com.termux/files/usr/bin/am to call /system/bin/cmd via tsu. I know this is a dirty hack(and script) I was in a bit of a rush...hope it might help somehow. #!/data/data/com.termux/files/usr/bin/bash
INPUT=$(echo "$@" | sed -e "s/^.*[-][-]user/--user/g"); tsu -c -s "LD_LIBRARY_PATH=/system/lib64 /system/bin/sh -c \"/system/bin/cmd activity broadcast $INPUT\""
Link by concludent on #termux: https://pastebin.com/Las0Cv7e
While not part of termux-api the command termux-wake-lock also does not work on Oreo.
+1
@fornwall I am a bit confused. Is there a work around? Will this be fixed?
+1
+1
+2
@Jim-Zenn I'm looking into it. I was hoping that it would be possible to use /system/bin/am even on Android 8 with some workaround, but it seems we have to use another mechanism (a service listening to connections).
@fornwall any news? The only thing that keeps me from upgrading to Oreo is Termux.
I heavily rely on termux-api in some of my apps. Since Termux is the killer app, how can the community help you? Maybe should you publish list of issues you face by this time?
@fornwall Any news with the fix? I have already upgraded my OnePlus 3T to Oreo and have a few scripts that depend on Termux-API to work properly... I should have checked for problems like this prior to upgrading, but now it's too late... 😕 And now I don't feel like messing with some obscure procedure just to downgrade my phone... 😁 (I didn't even check if this is possible, BTW) Thanks in advance.
+1
+1
Kindly give us a fix plz. My many scripts depends termux-api