Open sph0001 opened 3 years ago
I was also experiencing this issue in Unity 2021.1, and found that Unity was no longer correctly merging the Android manifest, so the permission for license verification was not being added to the built Android Manifest. I worked around the issue by taking Unity's generated manifest from the <project>\Temp\StagingArea\UnityManifest.xml
, copying it to <project>\Assets\Plugins\AndroidManifest.xml
, and then adding the permission <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
Awesome! Directly adding <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
to <project>\Assets\Plugins\Android\AndroidManifest.xml
worked for me. Thanks @DukeOfDelmar!
For future readers, here's what I discovered. Starting from Unity 2020 there is a fundamental change needed for a plugin folder to be considered an Android library: the folder name must end with ".androidlib" otherwise Unity won't use/merge the AndroidManifest included in the folder. Here's the Unity 2020.3 documentation: https://docs.unity3d.com/2020.3/Documentation/Manual/AndroidAARPlugins.html , in the "Android Library Projects" paragraph there's this very important change (you can check the 2019.4 documentation to see that it has been changed). So for example "GooglePlayLicensing" must be renamed to "GooglePlayLicensing.androidlib" and then the included AndroidManifest will me merged in the build. Without that, it simply won't be merged/included.
@Tanek81 said:
So for example "GooglePlayLicensing" must be renamed to "GooglePlayLicensing.androidlib" and then the included AndroidManifest will me merged in the build. Without that, it simply won't be merged/included.
Hi, @Tanek81. I finally got around to testing this and unfortunately simply changing "GooglePlayLicensing" to "GooglePlayLicensing.androidlib" does not seem to work. I think you're on the right track about needing to add ".androidlib" to the end of the folder name. But it seem the current project folder structure does not match the folder scheme required by Unity for Android Libraries. After I change the folder name and run my app the app is unable to find the jar file and errors out. For now going back to just adding the uses-permission line directly to the AndroidManifest file works fine but it would be nice if someone who knows how the folders should be structured makes the necessary change so the plugin will continue to work on upcoming versions of Unity out of the box...
Hi @sph0001 , I am sorry but I can't help you, we had so many issues on Android with Unity 2020.3 that we reverted to Unity 2019.4. For what I recall, the change I did fixed the issue with this plugin, but I don't know if now there is more to do, maybe Unity implemented some more changes in their latest 2020.3 build? I agree with you in saying that this of course should work out of the box with the latest Unity versions :)
I struggled with this repo for three years with my two Play Pass games and decided that it was time to address all its issues in a well-maintained Asset Store plugin: https://assetstore.unity.com/packages/tools/integration/google-play-license-check-227317
Feel free to ask me questions here or join the Unity forum discussion: https://forum.unity.com/threads/google-play-license-check-protect-your-game-from-piracy-and-hacking.1311378/
@KirillKuzyk please stop spamming.
@Over17 I'm sorry for that. My intention wasn't to spam, but to provide value for other developers. Telling people about my product here is the perfect place for people to know about it. Yes, it's a sort of advertisement, but my plugin solves many unaddressed issues that this repo has. Less work for you for maintaining this repo, more happy developers. Win-win for everyone as I see it.
Building a project that worked fine in Unity 2019.4 now causes the following error in Unity 2020.3:
Apparently I'm not the only one getting this error:
https://forum.unity.com/threads/google-play-pass-licencing-check-no-longer-working.1122247/
Any ideas about why this is happening and how to fix it?