错误:您当前选择的变体未知输出的 apk 未签名请为此变体指定签名配置调试

问题描述

升级到 Android Studio Arctic Fox (2020.3.1) Canary 9 后。我无法运行我的测试。它会弹出 Edit Configurations 窗口以显示 Error: The apk for your currently selected variant (UnkNown output) is not signed. Please specify a signing configuration for this variant (debug). 消息。我似乎无法通过创建 .jks 并像大多数建议的帖子一样使用发布签名配置来解决这个问题。我有点犹豫是降级还是尝试以某种方式解决它。有没有人以前遇到过这个问题?欢迎提出任何建议和意见。

enter image description here

Android Studio Arctic Fox (2020.3.1) Canary 10 版本同样存在问题。

解决方法

我也遇到过这种情况,这可能是因为升级到 Gradle 7.0.0 后修改了默认签名配置。您可以在不降级 Gradle 的情况下解决此问题。为此,

转到文件菜单>项目结构Step Reference Image 1

然后转到模块部分 Step Reference Image 2

然后前往默认配置标签 Step Reference Image 3

向下滚动到签名配置,然后点击下拉菜单 Step Reference Image 4

从下拉列表中选择 $signingConfigs.debug Step Reference Image 5

点击APPLY,然后确定,然后再次运行您的应用。

这为我解决了这个问题。希望它也适用于您。

,

如果 Android Gradle 插件 (AGP) 高于 7.0.0-alpha08,则会出现问题。所以降级到 7.0.0-alpha08 解决了这个问题。这样做,您还必须降级到 Android Studio Arctic Fox (2020.3.1) Canary 8,因为更高版本需要相应的 AGP 或最新版本。我对降级解决方案不满意。但这是目前运行测试的唯一方法。

Android Studio Archives

,

我遇到了同样的问题,并看到了您的帖子。 幸运的是,我能够修复它。请按照以下步骤操作: Build Variants(左下角)> Active Build Variant > 改回Debug

,

确保您没有在应用级 build.grade 中使用签名配置,或者尝试使用菜单栏中文件选项中的无效缓存/重启选项。

,

此问题现已在最新的 Android Studio 预览版 (2020.3.1 Canary 15) 中得到修复,使用 AGP 版本 7.0.0-alpha15