我有一个IntelliJ Android项目,我成功地导入到Android Studio 0.4.0。如果我不改变manifest中的任何东西,它就能很好地工作。然而,当我想要改变启动器活动并运行时,它会失败,并出现以下错误:

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.

当我点击同步项目与Gradle文件,它输出:

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

运行设置:


当前回答

Had the same error, with a much newer version of Android Studio (version 4.1) . A fresh install of Android Studio + a fresh "basic Activity" template would run into error type 3 for hours. I am on win 10 - my problem was how to kill the gradle cache. A good answer above showed a screen snapshot from gradle, but i didn't find it in Android Studio 4.1. Also the env vars for gradle had not been set , and the commandline for gradle didn't work. So .. here is how it worked finally. I went to C:\Users\myusername\ .gradle. This has subdir "caches". I deleted everything inside. Worked ! I did close Android Studio before, restarted and then it worked nicely. Ah forgot one thing- i run the device emulator (defauöt device), i.e. no physical device yet.

其他回答

Gradle ->任务->安装->全部卸载。

在所有这些解决建议之后,我仍然没有解决我的这个问题。然后我想起来我的手机有两个ANDROID用户界面。其中一个是休闲用的,另一个是你的私人物品。当我下载我的项目到手机,下载他们两个。我删除了我的项目在休闲的,但没有私人的。当我删除私人的时候,一切都很好。所以如果你有2个android用户界面,你应该删除他们,并重新下载。

去构建>重建项目

有时候,重命名项目的根目录就会发生这种情况,只需要删除项目的。idea文件夹,然后用Android Studio重新打开它。

删除虚拟设备并重新下载(在Android Studio 3.1.3上测试,2019年1月)。