How to start an app from the command line? I want to start an app with the package name de.avm.android.fritzapp
from a shell prompt because it occasionally quits. I have decompiled the .apk and got the AndroidManifest.xml.  

I have launched certain screens of app by:
am start -a android.intent.action.MAIN-n de.avm.android.fritzapp/.gui.SettingsTestActivity

But this is not the same as clicking the app icon on from the home screen.
Upon normal startup, the app registers with the router for receiving IP-calls, etc.

So how can I simply start the app as if it had been clicked on?
TL:DR;
adb shell monkey -p de.avm.android.fritzapp 1



Long Answer


  How can I simply start the app as if it had been clicked on?


You can start the main activity of the app
am start -n com.package.name/.MainActivityName

Since you have decompiled the App and got the manifest file so you would have the name of the main activity. You can get this information from the App's AndroidManifest.xml by searching for the activity with intent-filterand also contains android.intent.action.MAIN under action  

Check the activity element with skeleton as below  

&lt;activity android:name="this.is.main.activity.name you.are.looking.for"&gt;
    &lt;intent-filter&gt;
        &lt;action android:name="android.intent.action.MAIN" /&gt;
        &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;


You can start this particular app by
am start -n app de.avm.android.fritzapp/.gui.FRITZApp



Alternatively if you do not have the source code (manifest file), you can try the more general method where knowing the package name is enough with the help of Monkey tool as below:  

adb shell monkey -p package.name 1 (Simplified)  

The above command works because Monkey takes a constraint -c &lt;main-category&gt; which if not specified will select activities listed with the category Intent.CATEGORY_LAUNCHER which in turn becomes  

adb shell monkey -p package.name -c android.intent.category.LAUNCHER 1