我使用新发布的 Android Mobile SDK
成功集成了 LinkedIn
并且使用 Android Studio
一切顺利,但是当我生成 signed apk
显示下面提到的错误。我听说我们必须使用 debug.keystore
文件,否则这个错误 LinkedIn sdk 将返回相同的错误。
我也这样做了,但情况是当我们在 Android Studio 中生成签名的 apk 时,它提供的是 .jks 文件
而不是 .keystore 文件
。请告诉我如何生成 .keystore
文件的步骤以及如何在 build.gradle
中配置它。
错误:
Error={
"errorMessage": "either bundle id or package name \/ hash are invalid, unknown, malformed",
"errorCode": "UNKNOWN_ERROR"
}
我的 gradle 文件如下所示,我将 .jks
文件粘贴到应用程序方向,但在安装 signed apk
时它仍然没有运行,给出了我提到的错误, 但在 Debug模式下安装应用程序时它工作正常。
build.gradle:
allprojects {
repositories {
mavenCentral()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.myapp.hello"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
signingConfigs {
sdkTest {
storeFile file("secureln.jks")
storePassword "password"
keyAlias "secureln"
keyPassword "password"
}
release {
storeFile file("secureln.jks")
storePassword "password"
keyAlias "secureln"
keyPassword "password"
}
}
buildTypes {
sdkTest {
debuggable false
signingConfig signingConfigs.sdkTest
}
release {
debuggable false
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
compile project(':linkedin-sdk')
}
configurations {
}
dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.code.gson:gson:2.3.1'
}
我需要任何人帮助我。
最佳答案
由于您仅在签名 APK 时遇到此问题,您似乎配置了不正确的发布 key 哈希值。
尝试检查您用于签署 APK 的 keystore 的发布 key 哈希值是否正确列在您的 LinkedIn application 的“Android 包名称和哈希”字段中的配置如 documentation 中所述:
Generating a release key hash value
To generate a release key hash value, use the following command:
keytool -exportcert -keystore YOUR_RELEASE_KEY_PATH -alias YOUR_RELEASE_KEY_ALIAS | openssl sha1 -binary | openssl base64
Configure the valuesIn the "Android Package Names and Hashes" field of your LinkedIn application's configuration, provide one or more values in the following comma-separated format:
Android.Package.Name,Key-Hash-Value
关于Android LinkedIn 移动 SDK 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29787977/