Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play In-App Update Plugin needs update for Android 14 compatibility #236

Open
amjaliks opened this issue Jan 5, 2024 · 16 comments
Open

Comments

@amjaliks
Copy link

amjaliks commented Jan 5, 2024

Apps and games targeting Android 14 need to use the Play In-App Updates Library 2.1.0.

However, the latest version of the Play In-App Update Plugin, 1.8.1, depends on an older library version, 2.0.0. An update to this plugin is required to bump the dependency to the newer library version.

@fer-gamboa
Copy link

This is a temporal solution, but I found this solution on StackOverflow.

In short, what you need to do is find the Dependencies.xml file located at GooglePlayPlugins/com.google.play.appupdate/Editor and change it as follows:

<dependencies>
    <androidPackages>
        <androidPackage spec="com.google.android.play:app-update:2.1.0"/>
        <androidPackage spec="androidx.activity:activity:1.6.0" />
    </androidPackages>
</dependencies>

You need to put both. Then, go back to Unity, and use Force resolve. After that, the plugin is up-to-date and works in Android 14 -- just tested it.

@apar945
Copy link

apar945 commented Mar 6, 2024

Hello @fer-gamboa,

Thanks for sharing.
Is your workaround backwards compatible with Android 13 and older versions?
I have an app for which in app update works for Android 13 and older versions using this plugin.

For Android 14, the library crashes. So I use a cloud based setting that holds the latest version. On Android 14 devices this setting is checked and the user is prompted to update from play store. This is my workaround.

However, it would be easier to use your suggestion if it backwards compatible.

@fer-gamboa
Copy link

Hi @apar945! It actually works, I tested it on an Android 14, and on an Android 12 device.
Moreover, I have it live in one of my current apps and have received no crash reports associated with this feature so far--and yes, have pushed some updates since releasing it.

Regardless, it is a workaround, so I cannot vouch for its stability in the long-term. It seems to work for now.

@apar945
Copy link

apar945 commented Mar 14, 2024

@fer-gamboa, Thank you for the additional information. I am trying to get this workaround to work. It leads to lots of duplicate libraries. I delete the duplicates but I still haven't managed to build successfully. Do all other google plugins also need changes in their dependencies?

@apar945
Copy link

apar945 commented Mar 14, 2024

I managed to build the project with the changes by

  1. By updating unity 2021 version to current 2021.3.36f1
  2. Updating google plugins to latest 2024 releases from here (https://developers.google.com/unity/archive#play_asset_delivery)
  3. After updating google plugins, the unity project settings for Android are now forced to use Custom Main Gradle Template, Custom Gradle Properties Template.

With our next release candidate I will test in-app update on Android 14. I will provide an update once that is done.

@apar945
Copy link

apar945 commented Apr 4, 2024

@fer-gamboa, I recently started testing for in-app updates and it still doesn't work for me.

I wasn't using Android SDK installed with Unity so I switched to that. I am building for Android API 34 with API 28 as minimum supported. I have tried resolving external dependency manager and rebuilding. I get the following error on Android 14 and Android 12. So the changes have broken in-app updates that worked previously.

Error getting app update info. UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.play.core.appupdate.AppUpdateManagerFactory
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0
at Google.Play.AppUpdate.Internal.AppUpdateManagerPlayCore..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Google.Play.AppUpdate.Internal.AppUpdateManagerInternal..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Google.Play.AppUpdate.AppUpdateManager..ctor () [0x00000] in <00000000000000000000000000000000>:0
at WelcomePanel+d__89.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0

@fer-gamboa
Copy link

Hi!

I'm not really sure about the specifications of your project, so I'm a bit in the dark there. What I can suggest is that:

  • I'm also using another SDK, so that shouldn't be a problem.
  • Make sure you activate the custom manifest and gradle templates. You may need this to double-check that the dependencies have not been replaced by another import.
  • You may (conditional here) need to manually delete and reinstall the gradle dependencies for it to build correctly. What happened to us once was that because they have different versions, the folder names (of the dependencies) are different, so the old ones don't get replaced nor deleted... they just remain there, causing this problem.

I haven't had any of these problems so far, so I hope my suggestion help. Good luck!

@apar945
Copy link

apar945 commented Apr 7, 2024

@fer-gamboa,

Thank you for the pointers. What do the packages in your AndroidResolverDependencies.xml look like?

Mine are as follows. The core, core-common, integrity and asset-delivery are old and haven't updated.

<dependencies>
  <packages>
    <package>androidx.activity:activity:1.6.0</package>
    <package>com.google.android.play:app-update:2.1.0</package>
    <package>com.google.android.play:asset-delivery:2.2.1</package>
    <package>com.google.android.play:core:1.10.3</package>
    <package>com.google.android.play:core-common:2.0.0</package>
    <package>com.google.android.play:integrity:1.0.0</package>
  </packages>

@fer-gamboa
Copy link

fer-gamboa commented Apr 9, 2024

Hi @apar945

My AndroidResolverDependencies.xml has far more than yours, but the app-update one is correct.

However, just to be clear, you should not modify AndroidResolverDependencies.xml directly; doing so will leave the old version (of the dependency we're trying to update) on the plugin. Then, the dependencies manager will download both versions into your project (namely, the one required by the plugin, and the one forcefully added to AndroidResolverDependencies.xml ), thus producing the clash.

What you should do is go to: GooglePlayPlugins/com.google.play.appupdate/Editor and find a file that is called Dependencies.xml (note that it doesn't have anything else in the name). This file is for the specific plugin (namely, App Update). Change the version there to upgrade the plugin. Once done, try resolve, but do not edit AndroidResolverDependencies.xml manually.

If that's not the problem, I really don't know what may be wrong for your specific case. I have it working on production without problem, and tested it on Androids 12-14. However, as I mentioned on my proposal... this is just a workaround; it may not be stable. The best thing would be for Google to provide an official update.

@apar945
Copy link

apar945 commented Apr 9, 2024

@fer-gamboa, thank you for the response. I can confirm that I have done as described by you from the start.

My question was around the versions of core, core common dependencies. They are still the old version rather than the current version. I was hoping they would be updated as well.

I will continue looking further into this and post an update.

Regards

@apar945
Copy link

apar945 commented Apr 10, 2024

@fer-gamboa,

I finally got the update to work on Android 14 and older versions with your suggested changes to Dependencies.xml.

For others benefit, this is how I fixed it.
I ended up deleting all the google plugins except EDM from the project. Then I only added the latest in-app update plugin version 1.8.1 published Sept,2022 at the time of writing this message. The plugin package added the core, common and app bundle plugins itself.

Note: If you need the in app review, asset delivery and other plugins which have newer versions available, you may run into the issues I noticed.

This workaround is fine for me for now as I am not using the other plugins yet and I am hoping Google releases a new version of the plugin eventually which is in line all the other plugins that were updated.

@32nguyen
Copy link

32nguyen commented Jun 24, 2024

I currently have same issue with:
"Google Play In-App Updates (com.google.android.play:app-update) has added this note for SDK version 2.0.0:

Update your Play In-App Updates Maven dependency to an Android 14 compatible version! Your current Play In-App Updates library is incompatible with targetSdkVersion 34 (Android 14), which introduces a backwards-incompatible change to broadcast receivers. As a reminder, from August 31, Google Play requires all new app releases to target Android 14. Update to the latest library version dependency to avoid app crashes: https://developer.android.com/guide/playcore#java-kotlin-in-app-update

90 days after releasing this version of your app, you won't be able to release new versions containing this SDK version to production or open testing."

For some reason (out of my understanding), I have modified the Assets/GooglePlayPlugins/com.google.play.appupdate/Editor/Dependencies.xml and have these changes updated in "Asset/Plugin/Android/mainTamplate".

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'androidx.activity:activity:1.6.0' // Assets/GooglePlayPlugins/com.google.play.appupdate/Editor/Dependencies.xml:4
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:12
implementation 'androidx.lifecycle:lifecycle-process:2.4.1' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:17
implementation 'com.google.ads.mediation:ironsource:7.6.0.0' // Assets/GoogleMobileAds/Mediation/IronSource/Editor/IronSourceMediationDependencies.xml:24
implementation 'com.google.android.gms:play-services-ads:22.5.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
implementation 'com.google.android.gms:play-services-base:18.2.0' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.android.play:app-update:2.1.0' // Assets/GooglePlayPlugins/com.google.play.appupdate/Editor/Dependencies.xml:3
implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
implementation 'com.google.android.play:review:2.0.0' // Assets/GooglePlayPlugins/com.google.play.review/Editor/Dependencies.xml:3
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
implementation 'com.google.firebase:firebase-analytics:21.3.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
implementation 'com.google.firebase:firebase-analytics-unity:11.6.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
implementation 'com.google.firebase:firebase-app-unity:11.6.0' // Assets/Firebase/Editor/AppDependencies.xml:22
implementation 'com.google.firebase:firebase-common:20.3.3' // Assets/Firebase/Editor/AppDependencies.xml:13
implementation 'com.google.firebase:firebase-config:21.4.1' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
implementation 'com.google.firebase:firebase-config-unity:11.6.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
implementation 'com.google.firebase:firebase-crashlytics-ndk:18.4.3' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:13
implementation 'com.google.firebase:firebase-crashlytics-unity:11.6.0' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
// Android Resolver Dependencies End
DEPS}

I still have yellow warning when uploading internal testing version (got the red with previous production.)

@fer-gamboa
Copy link

Hi @32nguyen!

  1. Check the steps here: Play In-App Update Plugin needs update for Android 14 compatibility #236 (comment)
  2. Check here, because you need to clean dependencies: Play In-App Update Plugin needs update for Android 14 compatibility #236 (comment)

What may be happening is that your old dependencies are not being removed and/or updated.

Also, just be aware that this was a fix I did a while ago. I still have it working on production, but it's no guarantee that it'll not collide or clash with other dependencies you may have in your project.

@32nguyen
Copy link

Thanks for your reminder. Yes, it works. It needs to clean up the google plugins.

@Abhishek-D-Developer
Copy link

This is a temporal solution, but I found this solution on StackOverflow.

In short, what you need to do is find the Dependencies.xml file located at GooglePlayPlugins/com.google.play.appupdate/Editor and change it as follows:

<dependencies>
    <androidPackages>
        <androidPackage spec="com.google.android.play:app-update:2.1.0"/>
        <androidPackage spec="androidx.activity:activity:1.6.0" />
    </androidPackages>
</dependencies>

You need to put both. Then, go back to Unity, and use Force resolve. After that, the plugin is up-to-date and works in Android 14 -- just tested it.

This solution worked for me. Thank you very much!

@fer-gamboa
Copy link

This is a temporal solution, but I found this solution on StackOverflow.
In short, what you need to do is find the Dependencies.xml file located at GooglePlayPlugins/com.google.play.appupdate/Editor and change it as follows:

<dependencies>
    <androidPackages>
        <androidPackage spec="com.google.android.play:app-update:2.1.0"/>
        <androidPackage spec="androidx.activity:activity:1.6.0" />
    </androidPackages>
</dependencies>

You need to put both. Then, go back to Unity, and use Force resolve. After that, the plugin is up-to-date and works in Android 14 -- just tested it.

This solution worked for me. Thank you very much!

I am glad that it works.

To add, I believe that the latest version of In-App Update has already addressed this issue, making this solution unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants