Error type 3 Error: Activity class {} does not exi

2019-01-03 08:01发布

I have an INTELIJ(v12) android project successfully imported to AndroidStudio(v0.4.0). It works perfectly if I don't change anything in manifest. When I want to change the launcher activity and run, it outputs with the following error:

Launching application: com.trackingeng/LandingActivity.
DEVICE SHELL COMMAND: am start -D -n "com.trackingeng/LandingActivity"  
    -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN  
    cat=[android.intent.category.LAUNCHER] cmp=com.trackingeng/LandingActivity }
Error type 3
Error: Activity class {com.trackingeng/LandingActivity} does not exist.

When I click Sync Project with Gradle files it outputs:

Project Sync
The project 'TrackingEng' is not a Gradle-based project

Anyone has faced this problem? Any ideas?

Run settings: enter image description here

30条回答
\"骚年 ilove
2楼-- · 2019-01-03 08:42

Try changing the name of the Activity in your AndroidManifest.xml file.

Right now it says:

<activity android:name="LandingActivity" >

Try either adding a period to the beginning of the Activity's name:

<activity android:name=".LandingActivity" >

Or adding the package name to the beginning of the Activity's name:

<activity android:name="com.trackingeng.LandingActivity" >

It also may be a problem that your package name has only two components separated by periods (your package name is "com.trackingeng"; a more standard package name would be "com.trackingeng.app")

查看更多
可以哭但决不认输i
3楼-- · 2019-01-03 08:43

In my case there was next reason:

I have 2 users: me and Guest. and app was installed on both of them but deleted only at first.

when I switched to Guest screen and delete app from there, app installed ok.

hope this will help someone :)

查看更多
聊天终结者
4楼-- · 2019-01-03 08:45

None of the above worked for me. I had a version of the app on the device that could not be uninstalled as it was corrupt somehow. I had to factory reset the device. Not too bothered cause it was a just a dev device

查看更多
老娘就宠你
5楼-- · 2019-01-03 08:46

In my case, it was because the app I was trying to launch was installed for a different user on the device. Go to Settings -> Apps (All apps) and and select the app. Click on the overflow menu and select "Uninstall for all users". This should solve the problem.

查看更多
你好瞎i
6楼-- · 2019-01-03 08:46

Be warned that if you have multiple Profiles set on the device, your app might already exist in one of the other Profiles.

Uninstalling the app from all the Profiles resolved the issue for me.

查看更多
我只想做你的唯一
7楼-- · 2019-01-03 08:49

I have LG Stylus and in my test phone, application isn't remove permanently. In Settings -> Application I found debug app (which I try install and debug by AS) with adnotation turn-off. When I remove app from my phone, error disappeard.

查看更多
登录 后发表回答