How can I build a command line app for android?
<p>I want to build small app for android that I can run from the android command line while I'm remotely connected to the android device through ssh. I don't want a button/launcher/icon or gui interface of any kind.</p>

<p>I prefer to do this in golang if possible.</p>

<p>I tried using <code>gomobile</code> (<code>golang.org/x/mobile</code>) but when I put the apk on my device and try to run it I get the error:</p>

<pre><code>u0_a44@ghost:/data/data/berserker.android.apps.sshdroid/home $ am start gserv.apk                                         
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=gserv.apk }
java.lang.SecurityException: Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
    at android.os.Parcel.readException(Parcel.java:1546)
    at android.os.Parcel.readException(Parcel.java:1499)
    at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2504)
    at com.android.commands.am.Am.runStart(Am.java:770)
    at com.android.commands.am.Am.onRun(Am.java:307)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:98)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
</code></pre>

<p>The app is just a small hello world http server. How can I install and run it in a way that allows me to use it like other command line programs built into android that don't require gui (<code>ls</code>, <code>cat</code>, <code>cd</code>, etc).</p>