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

运行设置:


当前回答

下面的命令对我很有用。有时部分卸载应用程序也会导致这种情况。

在终端/cmd中执行以下命令

adb uninstall <package_name>

然后,尝试重新安装应用程序。它应该会起作用。

其他回答

这适用于Android Studio 4.0.1版本:

把我的git分支改为主分支 回到我自己的分支

我读了所有的“运行”日志,在那里我看到了这一行:

"Exception occurred while executing:
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space"

我的问题是,没有内部的空闲空间来安装应用程序。所以,我删除了一些文件,应用程序安装成功。

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.

问题是由于在设备仍然插入时卸载应用程序引起的。 设备会禁用应用,而不是删除应用。

进入你设备上的应用程序列表,从那里卸载应用程序。您将看到它当前被标记为禁用。这就是为什么你不能运行应用程序,因为Android Studio无法安装它,因为它认为它已经存在。

在manifest文件和build.gradle(Module:app)中保持包名相同。它解决了我的问题。