尝试设计简单的谷歌地图相关应用程序。 App在调试模式下运行正常,但是当我通过在App中提供发布SHA1指纹和包名称来重新创建和更改Google Map API密钥来切换到发布模式时,还可以通过提供正确的配置文件来将版本类型更改为发布。
但是当我运行应用程序时会出现以下错误
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: Google Map API Key (with release SHA1 fingerprint)
Android Application (<cert_fingerprint>;<package_name>): Debug SHA1 fingerprint;com.mycompany.packagename
我被困在这里,无法在App中更改SHA1指纹以释放一个。请帮我解决这个问题。
答案 0 :(得分:1)
最后我找出问题所在。使用GUI在构建期间进行签名并不起作用。因此,要检查发布版本,您需要按如下方式更改Gradle并同步项目。
apply plugin: 'com.android.application'
android {
signingConfigs {
debug {
storeFile file('debug.keystore')
}
release {
keyAlias 'Key'
keyPassword 'Pass'
storeFile file('C:/Users/hp/AndroidStudioProjects/project/key.keystore')
storePassword 'Pass'
}
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.mypackage"
minSdkVersion 15
targetSdkVersion 21
versionCode 6
versionName "6.0"
}
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
debuggable false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
}
检查App的发布版本。运行&#34; assemblerelease&#34;并在以下路径\ build \ outputs \ apk * release.apk
中找到发布apk我认为此解决方案适用于其他人。
由于