AppLicensing失败 - 签名为空字符串

Tor*_*ist 5 android licensing in-app-purchase in-app-billing google-play

我已经为InApp-Billing实现了App-Licensing,现在我已经开始了Error.NOT_LICENSED,我不知道出了什么问题.我正在处理的版本尚未发布到游戏商店.

这是我用来启动许可过程的代码:

private void checkLicense(int retries) {
  if (retries != 5) {
    String publicKey = "YOUR KEY";
    final CdcLicenseCheckerCallback callback = new CdcLicenseCheckerCallback();
    String deviceId = mPrefsHandler.getDeviceId();
    deviceId = deviceId != null ? deviceId : UUID.randomUUID().toString();
    mPrefsHandler.setDeviceId(deviceId);
    Crashlytics.setBool("has Device-Id", deviceId != null);
    final LicenseChecker checker = new LicenseChecker(this, new ServerManagedPolicy(this,
        new AESObfuscator(new byte[] { 1, 1, ... , 1 }, getPackageName(),
            deviceId)), publicKey);
    checker.checkAccess(callback);
  }
}
Run Code Online (Sandbox Code Playgroud)

我使用了一个生产变体来弄清楚发生了什么,并发现,在该方法LicenseValidator.java的参数是一个空字符串,导致返回.signatureverifysig.verify(Base64.decode(signature))ERROR.NOT_LICENSED

if (!sig.verify(Base64.decode(signature))) {
  Log.e(TAG, "Signature verification failed.");
  handleInvalidResponse();
  return;
}
Run Code Online (Sandbox Code Playgroud)

我只有一个UUID.randomUUID().toString()可能是问题的暗示,但我不知道,无论是实际的,也不知道该做什么.

Tor*_*ist 8

发现了问题.我实际上没有将alpha版本发布到Playstore,所以google play明确禁止使用更新的版本,因为它不知道它

解决方案:检查您安装的应用版本是否低于或等于发布到Google Play的最新版本(Alpha,测试版或制作频道)