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条回答
可以哭但决不认输i
2楼-- · 2019-01-03 08:50

I took reference from @jayeffkay's comment.

It works for me after I deleted the gradle cache files located in

/your_proj_directory/.gradle/2.10

2.10 is the gradle version used in my case.

查看更多
闹够了就滚
3楼-- · 2019-01-03 08:50

I had same issue. My problem fixed when I disabled instant run for Android Studio 2.1.1

查看更多
Explosion°爆炸
4楼-- · 2019-01-03 08:50

I face the similar Problem please follow the below steps.
it will help you:

1- Clean your Project
2- Delete your build directory
3- Restart your Android Studio
4- Rebuild the project
5- it will run successfully.

Thanks

查看更多
Emotional °昔
5楼-- · 2019-01-03 08:50

If you have uninstalled the application manually from the device and you have multi user set up, this error could happen. The application needs to be uninstalled from all the users in the device.

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

Even I had the same problem but none of the above solutions worked for me. The problem was that, I had froze the particular app which I was trying to run via Titanium Backup due to which I got the above error. I tried both in Eclipse and Android Studio.

After the realization I just unistalled the app and then ran it again.

Problem Solved :-)

查看更多
三岁会撩人
7楼-- · 2019-01-03 08:51

I use Android Studio 3.2 Beta 5, faced with the same issue

Go to

File -> Invalidate Caches / Restart...

Solved problem for me

查看更多
登录 后发表回答