Android LinkedIn移动SDK错误?

Android LinkedIn mobile SDK error?

我使用新发布的 Android Mobile SDK 成功集成了 LinkedIn,并且使用 Android Studio 一切都很好,但是当我生成 signed apk 时显示了下面提到的错误。我听说我们必须使用 debug.keystore 文件否则这个错误 LinkedIn sdk 将 return 同样的错误。 我也这样做了,但情况是当我们在 Android Studio 中生成签名的 apk 时,它给出的是 .jks file 而不是 .keystore file。请告诉我如何生成 .keystore 文件的步骤以及如何在 build.gradle.

中配置它

错误:

  Error={
"errorMessage": "either bundle id or package name \/ hash are invalid, unknown, malformed",
"errorCode": "UNKNOWN_ERROR"
    }

我的 gradle 文件如下所示,我将 .jks 文件粘贴到应用程序方向,但在安装 signed apk 时仍然没有 运行 给出错误我提到过,但在调试模式下安装应用程序时它工作正常。

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 时遇到此问题,看来您配置的发布密钥哈希值不正确。

尝试检查您用于签署 APK 的密钥库的发布密钥哈希值是否正确列在 LinkedIn application's configuration as described in the documentation 的 "Android Package Names and Hashes" 字段中:

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 values

In 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

在 SDK 中,示例应用和事件应用中有 "debug.keystore" 文件 该密钥库文件的密码是:android

使用该密钥库文件签署该示例或事件应用程序。它会解决你的问题

对于调试 apk,我意识到我使用了错误的密码,因为默认的调试密钥库密码是 android ,文档中给出的命令将为任何密码生成哈希密钥, 请使用正确的密码以节省时间