我有一个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工作室,如果这没有工作,然后使缓存无效。 如果它仍然给你错误,然后尝试清除模拟器的数据,希望这将解决问题,

确保您的活动名称是正确的,也确保包名称是正确的清单文件。

其他回答

这种情况发生在我使用react-native run-android时,因为我的包名称与我的应用程序ID不匹配。只需添加——appId YOUR_APP_ID。

我的包名为“barisciftci.PatternApplier”。所以把它改为小写解决了我的问题,所以现在它看起来像“barisciftci.patternapplier”。

我在不同的设备上尝试了相同的应用程序,它可以工作。最后我注意到应用程序被禁用:

进入设置/应用程序(在手机上) 如果已禁用,请将其移除

在我的情况下,这是由ndk abiFilters编译手臂时引起的。 为了解决这个问题,我不得不在app/build中添加以下“分割”部分。Gradle的android block:

splits {
    abi {
        enable true //enables the ABIs split mechanism
        reset() //reset the list of ABIs to be included to an empty string
        include "armeabi-v7a", "arm64-v8a", "armv7l"
        universalApk true
    }
}

重命名我的包后,我面临这个问题…

所以最简单的一个是去文件->无效缓存/重新启动....