代码之家  ›  专栏  ›  技术社区  ›  TormundThunderfist

AppLicensing失败-签名为空字符串

  •  5
  • TormundThunderfist  · 技术社区  · 7 年前

    我已经为InApp计费实施了应用程序许可,现在 Error.NOT_LICENSED 我不知道怎么了。我正在开发的版本尚未发布到play store。

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

    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);
      }
    }
    

    我使用了一个生产变量来了解发生了什么,并在 LicenseValidator.java ,参数 signature 对于方法 verify 是空字符串,导致 sig.verify(Base64.decode(signature)) 返回 ERROR.NOT_LICENSED .

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

    我只有一点想法 UUID.randomUUID().toString() 这可能是个问题,但我不知道,到底是不是,也不知道该怎么办。

    1 回复  |  直到 7 年前
        1
  •  8
  •   TormundThunderfist    7 年前

    发现问题。实际上,我还没有将alpha版本发布到playstore,所以google play明确禁止更新版本,因为它不知道

    解决方案:检查您安装的应用程序版本是否低于或等于发布到google play的最新版本(alpha、beta或production channel)