Thursday, June 13, 2024

Fix Play Store warnings because outdated PlayCore SDK

Today, when you want to publish or update an app, Google Play asks for: com.google.android.play:core added the following note for core (1.10.3):

If your app is targeting SDK 34+ (targetSdkVersion), then the PlayCore SDK is outdated and will likely cause crashes in your app! Please update: https://developer.android.com/guide/playcore#playcore-migration

To solve this problem in our code, it is necessary to update the dependencies in the build.gradle (Module: app) file and in the MainActivity.java file. This applies in general to all codes from solodroid.

Step 1 (Updating dependencies)

Open the build.gradle (Module: app) file, find the library implementation below and remove it.

implementation 'com.google.android.play:core:1.10.3'

Add or change it with the 2 new libraries implementation below and Sync now.
implementation 'com.google.android.play:review:2.0.1'
implementation 'com.google.android.play:app-update:2.1.0'

Step 2 (Updating MainActivity.java)

Open the MainActivity.java file, find the following code below, for quick search, use Ctrl + F.
import com.google.android.play.core.tasks.Task;

Replace it with the code below, to make it faster, you can use Ctrl + R to replace the code with a new one:
import com.google.android.gms.tasks.Task;

Share: