问题
Android studio doesn't launch any application (even new from the studio templates) and fails with the same error:
09/29 13:54:36: Launching app
$ adb push /Users/user/AndroidStudioProjects/MyApplication/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.example.user.myapplication
$ adb shell pm install -r "/data/local/tmp/com.example.user.myapplication"
Aborted
$ adb shell am start -n "com.example.user.myapplication/com.example.user.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.user.myapplication/com.example.user.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.user.myapplication/.MainActivity }
Error type 3
Error: Activity class {com.example.user.myapplication/com.example.user.myapplication.MainActivity} does not exist.
Error while Launching activity
I tried clean/rebuild, even reinstall studio, but it didn't help. I can't understand what's happening, please help
回答1:
try adding this to your manifest on MainActivity
<activity
android:name=".MainActivity"
...
...
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
回答2:
This is happening....
Error: Activity class {com.example.user.myapplication/com.example.user.myapplication.MainActivity} does not exist.
Your MainActivity class does not exist or something which has been fixed as your launcher activity. Check your manifest file. In your manifest file you have delcared MainActivity as your launcher Cheers
回答3:
If you are using android studio version 2.1 and you enable instant run feature then some times these type error occur.
Clean your project or rebuild then problem resolved. for avoiding this problem disable instant run feature from setting
来源:https://stackoverflow.com/questions/39768633/crash-while-trying-to-launch-any-application