我试图运行一个选定的构建变体,但在运行选项卡中给我以下错误,

无法确定应用程序id: com.android.tools.idea.run.ApkProvisionException:没有输出main artifact of variant: madhyapradesh-debug

所以请提出解决方案。


当前回答

首先是清洁项目和重建项目。如果它不起作用,那么简单,硬核,快速的方法,这对我来说是有效的,只是在关闭IDE并重新启动它后删除下面两个名为。gradle和。idea的文件夹

其他回答

项目结构- 建议- 更新它

尝试在Android Studio终端上运行以下命令:

gradlew connectedAndroidTest

确保您已经设置了applicationId com.example。Myapp”在你的build.gradle

android {
    ...
    defaultConfig {
        applicationId "com.example.myapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    ...
}

从app ->编辑配置,确保你选择了“默认活动”

@applixy的答案很适合我。 1.只需注意将类路径更新到最新版本 项目- >构建。gradle将

classpath’com。android工具。构建:gradle: 4 1。1。

2.在gradle->包装器中。属性只是应用同步与gradle upon - 6.5 - all.zip distributionUrl = https://services.gradle.org/distributions/gradle

3.我的项目已经在所有项目{}上有谷歌()方法。 因此,构建项目并运行就可以了。

查看Gradle Table =>右键点击应用程序=>点击“Reload Gradle Project”