我有一个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.

其他回答

我有一部三星Galaxy。在上面的设置中搜索不起作用,因为它根本没有出现在我的应用程序设置中。

我通过在搜索栏中输入应用程序的名称在我的手机上找到了这个应用程序。我意识到它在“工作”(使用Mobile@Work)配置文件中,并删除了它。您可以通过“设置->工作配置文件->应用程序”找到配置文件的设置

我希望这能帮助到一些人,他们可能不会以同样的方式找到它,许多其他答案都可以在设置中找到。

当您执行以下操作时,就会发生这种情况

连接您的设备/模拟器 从Android Studio (AS)运行应用程序 使用/测试应用程序,并将其从设备上卸载 连接到您的计算机 尝试从AS重新运行应用程序

AS认为你的设备上还有应用程序。

tl;dr -要解决这个问题,你可以简单地断开你的设备卸载应用程序后,重新连接它。

尝试在AndroidManifest.xml文件中更改Activity的名称。

现在它说:

<activity android:name="LandingActivity" >

尝试在Activity名称的开头添加一个句点:

<activity android:name=".LandingActivity" >

或者将包名添加到Activity名称的开头:

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

这也可能是一个问题,你的包名只有两个用句点分隔的组件(你的包名是"com.trackingeng";更标准的包名应该是"com.trackingeng.app")

我修改了一个NDK,问题就解决了。

检查Gradle文件中的应用程序id。我遇到了同样的问题,因为我在重构视图名称时不小心更改了应用程序id。