I have the following command
adb -s 077743323A102985 shell am start -n com.instagram.android/.MainActivity
i am trying to start the instagram app via command line, but why does it gives me this error:
Starting: Intent { cmp=com.instagram.android/.MainActivity }
Error type 3
Error: Activity class {com.instagram.android/com.instagram.android.MainActivity} does not exist.
the app is installed and the package name is com.instagram.android
You should try to use LauncherActivity
instead of MainActivity
. The package name of the LauncherActivity is also a little bit different.
To sum up, the following command will start Instagram app from the terminal:
adb -s 077743323A102985 shell am start -n com.instagram.android/com.instagram.mainactivity.LauncherActivity
In order to know which Activity to use to start an app you can follow these steps:
AndroidManifest.xml
file<action android:name="android.intent.action.MAIN"/>
and <category android:name="android.intent.category.LAUNCHER"/>
intent filtersandroid:targetActivity
attributeYou can apply these steps to all apps not only Instagram.