gpt4 book ai didi

Android Studio 3.5.2 - 错误 : The apk for your currently selected variant (app-release-unsigned. apk) 未签名

转载 作者:行者123 更新时间:2023-12-03 13:43:05 25 4
gpt4 key购买 nike

一点背景。几个月来我一直在构建/调试/测试我的简单应用程序,没有任何问题。在 AVD 或我实际的 S9 手机上构建/安装。几个月来一切都很好。现在,准备好在 Play 商店中发布我的第一个 beta 版本(我的第一个应用程序)。所以,我按照“签署”我的应用程序的说明进行操作。那行得通,我将我的应用程序包上传到了 Play 商店。现在我再也无法在 Android Studio 中构建/调试/安装了。
错误:您当前选择的变体 (app-release-unsigned.apk) 的 apk 未签名。请为此变体(版本)指定签名配置。
enter image description here
调试 (Shift+F9) 产生上述错误并显示“编辑配置”对话框。
enter image description here
我点击“修复”按钮,从那里我不知道该怎么做。或者如何使用这些不同的构建配置。
enter image description here
构建.gradle

apply plugin: 'com.android.application'

android {
signingConfigs {
debug {
storeFile file(var)
storePassword 'xxx'
keyAlias = 'xxx'
keyPassword 'xxx'
}
}
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.birdersdiary.mobile"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "b1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
单击“修复”按钮后,我将进入“运行/调试配置”对话框。从那里开始,我完全忘记了为了解决问题需要发生什么。
非常感谢任何帮助。

最佳答案

您可以通过执行以下任何操作来解决此问题

  • 您需要将构建变体切换回调试,您可以通过在 Windows 上按住 Ctrl+Alt+A 或在 Mac 上按住 CMD+ALT+A 然后键入 variant 来执行此操作。在搜索栏中,选择 build variant ,这将在您的 android studio 屏幕左侧显示构建变体选项,然后您应该选择名称附加了调试的变体。
  • 如果你想使用发布版本,你需要指导 android studio 如何找到 key 来签署 apk
    将此添加到您的应用程序级别 build.gradle文件
    apply plugin: 'com.android.application'

    android {
    signingConfigs {
    debug {
    storeFile file(var)
    storePassword 'xxx'
    keyAlias = 'xxx'
    keyPassword 'xxx'
    }
    release {
    storeFile file(var)
    storePassword 'xxx'
    keyAlias = 'xxx'
    keyPassword 'xxx'
    }
    }
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
    applicationId "com.birdersdiary.mobile"
    minSdkVersion 15
    targetSdkVersion 29
    versionCode 1
    versionName "b1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.preference:preference:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    }

  • 用实际值替换占位符。

    关于Android Studio 3.5.2 - 错误 : The apk for your currently selected variant (app-release-unsigned. apk) 未签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59111920/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com