Crash while trying to launch any application

我怕爱的太早我们不能终老 提交于 2019-12-13 09:46:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!