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

运行设置:


当前回答

禁用Android Studio的即时运行(在2.1.1版本上测试)

其他回答

对我来说,问题在于AndroidStudio认为应用还在设备上。

解决方法:

重新启动adb守护进程;在终端或命令提示符中输入: 亚行kill-server 亚洲开发银行启动服务器 尝试启动你的应用程序。 如果还是不行,看看这个答案。

确保Android SDK的平台工具添加到你的系统路径变量中!

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

我参考了@jayeffkay的评论:

我必须删除gradle缓存,正如这里所描述的,Android Studio在运行.apk时得到错误的包名

它为我工作后,我删除gradle缓存文件位于:

/your_proj_directory/.gradle/2.10

2.10是我使用的gradle版本。

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.

发生在我改变应用程序名称时。卸载app,从调试版本切换到发布版本,安装发布版本,然后切换回调试版本并工作。