termux-api icon indicating copy to clipboard operation
termux-api copied to clipboard

Termux API doesn't work on Android O

Open jimzenn opened this issue 9 years ago • 53 comments

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.

jimzenn avatar Aug 13 '17 07:08 jimzenn

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.

eladts avatar Aug 26 '17 14:08 eladts

Same issue with Android O installed on Nexus 6p

datalin avatar Sep 02 '17 19:09 datalin

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 "$@"

fornwall avatar Sep 24 '17 21:09 fornwall

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 avatar Sep 24 '17 22:09 eladts

@eladts there are many benefits to keep Termux::API as an Addon.

  1. Permission issues
  2. 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.

SDRausty avatar Sep 24 '17 23:09 SDRausty

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.

fornwall avatar Sep 26 '17 13:09 fornwall

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\""

ghost avatar Oct 16 '17 03:10 ghost

Link by concludent on #termux: https://pastebin.com/Las0Cv7e

fornwall avatar Oct 28 '17 06:10 fornwall

While not part of termux-api the command termux-wake-lock also does not work on Oreo.

eladts avatar Oct 28 '17 10:10 eladts

+1

y2kbugger avatar Nov 06 '17 06:11 y2kbugger

@fornwall I am a bit confused. Is there a work around? Will this be fixed?

jimzenn avatar Nov 21 '17 16:11 jimzenn

+1

brancengregory avatar Nov 22 '17 02:11 brancengregory

+1

jonathanwalker avatar Nov 26 '17 03:11 jonathanwalker

+2

ofus avatar Dec 02 '17 19:12 ofus

@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 avatar Dec 03 '17 14:12 fornwall

@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?

moldabekov avatar Jan 02 '18 11:01 moldabekov

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

CrisVM avatar Jan 09 '18 20:01 CrisVM

+1

heyitswither avatar Jan 13 '18 23:01 heyitswither

+1

Bestfast avatar Jan 17 '18 13:01 Bestfast

Kindly give us a fix plz. My many scripts depends termux-api

srajasimman avatar Jan 26 '18 14:01 srajasimman