简体   繁体   English

Android 许可证测试响应 - 从不工作

[英]Android License Test Response - Never works

I've been working on an Android App that has already been published to Google Play.我一直在开发一款已经发布到 Google Play 的 Android 应用程序。 For the next update (versionCode = 3) my client wants to include the LVL licensing scheme.对于下一次更新 (versionCode = 3),我的客户希望包括 LVL 许可方案。

The first thing I did was set up a static test response from the licensing server.我做的第一件事是设置来自许可服务器的静态测试响应。 I set the test response to LICENSED .我将测试响应设置为LICENSED After reading this in the documentation:在文档中阅读此内容后:

This License Test Response will be sent to devices using [my email address] or the Test Accounts listed above for applications you have uploaded to Google Play.此许可证测试响应将发送到使用 [我的电子邮件地址] 的设备或上面列出的用于您已上传到 Google Play 的应用程序的测试帐户。 >Additionally, this account (but not the Test Accounts) will receive this response for >applications that have not yet been uploaded to Google Play. >此外,此帐户(但不是测试帐户)将收到针对尚未上传到 Google Play 的应用程序的此响应。

I thought, not a problem, since my developer account email is the same as my Google Play account email on my testing devices.我想,这不是问题,因为我的开发者帐户电子邮件与我的测试设备上的 Google Play 帐户电子邮件相同。 So I should receive the test response when debugging the App.所以我应该在调试应用程序时收到测试响应。

After that, I read through all the other licensing documentation and sample code and integrated it into the App.之后,我通读了所有其他许可文档和示例代码并将其集成到应用程序中。 I used a ServerManagedPolicy with the correct base64 public key and 20 random generated bytes as the salt.我使用了具有正确 base64 公钥和 20 个随机生成的字节作为盐的ServerManagedPolicy

Once everything looked good I uploaded it to the device to test it, but instead of receiving the LICENSED response that I expected, I am always receiving a NOT_LICENSED response.一旦一切看起来都不错,我就将它上传到设备上进行测试,但我没有收到我预期的LICENSED响应,而是总是收到NOT_LICENSED响应。 I went back and made sure that:我回去并确保:

  1. I was connected to the internet.我已连接到互联网。
  2. I was signed in to my developer account on Google Play.我在 Google Play 上登录了我的开发者帐户。
  3. The LicenseChecker was using the correct public key. LicenseChecker 使用了正确的公钥。
  4. Clearing my Google Play cache.清除我的 Google Play 缓存。

At first, I thought maybe it had something to do with the caching, so I tried using a StrictPolicy instead.起初,我认为这可能与缓存有关,所以我尝试改用StrictPolicy Same response.同样的回应。 Since I haven't purchased the App from the store, I'm under the impression that the licensing server is responding normally instead of sending the static test response .由于我没有从商店购买应用程序,我的印象是许可服务器正常响应,而不是发送静态测试响应 Here are some other things I have tried:这是我尝试过的其他一些事情:

  1. Waiting 24 hours and trying again.等待 24 小时,然后重试。
  2. Tried building the App with the android debug key, as well as the current distribution key.尝试使用 android 调试密钥以及当前分发密钥构建应用程序。
  3. Setting up and using a different test user account on Google Play.在 Google Play 上设置和使用不同的测试用户帐户。 I made sure to add this email account to the 'Test accounts' section in the developer console.我确保将此电子邮件帐户添加到开发者控制台的“测试帐户”部分。
  4. Uploading the APK to Google Play, but not publishing it.将 APK 上传到 Google Play,但不发布。
  5. Incrementing the versionCode from 2 to 3. This is interesting, because instead of responding NOT_LICENSED it returns the 'application error code' ERROR_NOT_MARKET_MANAGED .将 versionCode 从 2 增加到 3。这很有趣,因为它没有响应NOT_LICENSED ,而是返回“应用程序错误代码” ERROR_NOT_MARKET_MANAGED

This leads me to believe that the license server is always responding normally, instead of sending the static test response I set up to my developer account.这让我相信许可证服务器总是在正常响应,而不是将我设置的静态测试响应发送到我的开发者帐户。 I have a feeling it may be because the App is already published, but I cannot risk publishing a debug build just to test wether or not it is working.我有一种感觉,这可能是因为该应用程序已经发布,但我不能冒险发布调试版本来测试它是否正常工作。

Has anyone been in this situation before?有没有人遇到过这种情况? Any help is greatly appreciated.任何帮助是极大的赞赏。

I've spent hours and even days with the same problem, it is documented here and elsewhere, that pre-published license test is hit and miss, and more miss than hit from what I discovered. 我花了几个小时甚至几天同样的问题,这里和其他地方都有记录,预先发布的许可证测试是命中和错过,而且比我发现的更多的错过。

The only way I've found to make it work "more reliably" (but still not totally reliable) is to have a hardware device that is a reset to factory defaults, then set it's PRIMARY google user as the same one as your dev account that has the app uploaded to test with. 我发现使其工作“更可靠”(但仍然不完全可靠)的唯一方法是将硬件设备重置为出厂默认设置,然后将其设置为与您的开发帐户相同的主要Google用户将应用程序上传到测试中。

The special AVDs are also not very reliable. 特殊的AVD也不太可靠。

I had the same issue but was able to resolve it. 我有同样的问题,但能够解决它。 Here are the things I did to fix: 1) on my device, I removed all google accounts except the test account I had configured for. 以下是我要解决的问题:1)在我的设备上,我删除了除我配置的测试帐户以外的所有Google帐户。 Apparently, play store was still trying to use a non testing account. 显然,Play商店仍在尝试使用非测试帐户。

2) I had to activate test status for my developer account even though I'm the main developer and only tester. 2)我必须为我的开发者帐户激活测试状态,即使我是主要的开发人员和唯一的测试人员。

the version increment thing did not help and honestly was a distraction..... 版本增量的东西没有帮助,老实说是分心.....

I have the same problem when testing using LVL library. 使用LVL库测试时遇到同样的问题。 I always get the 561 (0x231 NOT_LICENSED) response no matter what I set the License Test Response to in the settings page. 无论我在设置页面中设置了许可测试响应,我总是得到561(0x231 NOT_LICENSED)响应。

My paid app users don't seem to complain so I'm assuming LVL is working for them. 我的付费应用程序用户似乎没有抱怨所以我假设LVL正在为他们工作。

At first one of my apps had this problem and it went away after 1 day (published Dec 30 2012), now I get valid test response in that app. 起初我的一个应用程序出现了这个问题,它在1天后发布(2012年12月30日发布),现在我在该应用程序中获得了有效的测试响应。

However, I still get the 561 (0x231 NOT_LICENSED) response for a newer app (published Jan 31 2013) 但是,对于较新的应用程序(2013年1月31日发布),我仍然得到561(0x231 NOT_LICENSED)响应

So now I just comment out (disable the alert dialog code that pops up for 561) after I publish the APK and continue my development for the next release. 所以现在我发布APK后继续注释掉(禁用弹出561的警报对话框代码)并继续开发下一个版本。

I un-comment (enable the alert dialog code) before I publish again! 在我再次发布之前,我取消注释(启用警报对话框代码)!

I contacted Google Play, they referred me to their developer forums. 我联系了Google Play,他们将我推荐给他们的开发者论坛。 I posted the same question there but then I can't find my post. 我在那里发布了同样的问题,但后来我找不到我的帖子了。

Good to know that I'm not the only one facing this problem. 很高兴知道我不是唯一面临这个问题的人。

Not sure I am adding anything new but having similar problems and frustrations at what-should-be-happening vs what-is-happening I'll offer up this which seemed to work: 1) remove all of the users in the Play Console's license testing list of users;不确定我是否添加了任何新内容,但在应该发生什么和正在发生什么方面有类似的问题和挫折我会提供这个似乎有效的方法:1)删除 Play 控制台许可证中的所有用户测试用户列表; 2) whatever device you are testing remove all of the Google accounts; 2) 无论您正在测试什么设备,请删除所有 Google 帐户; 3) on that same device create a new, unique Google account (eg, iamalicensetester@gmail.com); 3) 在同一台设备上创建一个新的、唯一的 Google 帐户(例如,iamalicensetester@gmail.com); 4) add that Google account to the Play Console license testing list of users. 4) 将该 Google 帐户添加到用户的 Play Console 许可测试列表中。

What I think might be happening is that if you have more than one account on a device and one of them is licensed then a non-licensed account of that same device (or other devices) will inherit that characteristic.我认为可能发生的情况是,如果您在一台设备上拥有多个帐户并且其中一个已获得许可,那么同一设备(或其他设备)的非许可帐户将继承该特征。 This idea of mine is just a model (all models are wrong, but some are useful) to (mostly) allow me to get back to the work of testing...and (partially) to have some way to explain this nonsense to myself.我的这个想法只是一个模型(所有模型都是错误的,但有些是有用的)(大部分)让我回到测试工作......并且(部分)有一些方法来解释这个废话给自己.

I did try most of the things mentioned above...clearing the cache, the storage, etc. -- you'd think that Google would want a better facility with dashboarding but don't know if that is even on their radar.我确实尝试了上面提到的大部分事情……清除缓存、存储等——你可能认为谷歌会想要一个更好的仪表板设施,但不知道他们是否在考虑这一点。 I mean, revenue, right?我的意思是,收入,对吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM