I work on project with legacy code from 2016 and last month I got this email from google play console.
===========================================
Hello,
There are new SDK issues for Your App.
com.google.android.play:core:1.10.3
Google Play Core (com.google.android.play:core) has added this note for SDK version 1.10.3:
Update your Play Core Maven dependency to an Android 14 compatible version! Your current Play Core library is incompatible with targetSdkVersion 34 (Android 14), which introduces a backwards-incompatible change to broadcast receivers to improve user security. As a reminder, from August 31, Google Play requires all new app releases to target Android 14. Update to the latest Play Core library version dependency to avoid app crashes: https://developer.android.com/guide/playcore#playcore-migration
From September 18, 2024 00:00 (UTC) you won't be able to release new versions of your app containing this SDK version to production or open testing.
If you have questions about this SDK, contact the provider.
Sincerely,
The Google Play team
===========================================
1. Change play core library
from com.google.android.play:core:1.10.3
to 'com.google.android.play:app-update:2.1.0'
in my case I just use app-update library.
2. Update target SDK version to 34, when targeting to this version whe need to add namespace on our gradle file and when we build using gradle 7 there will be suggestion to build with gradle 8 or latest.
We recommend using a newer Android Gradle plugin to use compileSdk = 34
This Android Gradle plugin (7.2.2) was tested up to compileSdk = 33
3. Update android gradle plugin on root gradle file
from classpath 'com.android.tools.build:gradle:7.2.2'
to classpath 'com.android.tools.build:gradle:8.2.2'
4. Update distributionUrl in gradle-wrapper.properties
from distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
to distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
5. When we use gradle 8, it's required to using java 17, so whe have to update compileOptions and kotlinOptions like this :
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
6. Update Gradle JDK on your android studio
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Set Gradle JDK to 17
7. Update Kotlin
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22' on root of gradle
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22" on gradle app
8. Add some config on gradle.properties.
android.nonTransitiveRClass=false
android.enableR8.fullMode=false
android.nonFinalResIds=false
Note : this is optional use it when necessary. Learn more about this configs.
9. Adjust your code, with behavior changes in Android 14 for avoiding error / crash
10. If you use CI/CD, you have to change your docker image that contains SDK 34 with JDK 17.
In my case I use this docker image theimpulson/gitlab-ci-android:android-34
previously I use jangrewe/gitlab-ci-android:latest
So, there are my step by step when migration to SDK 34 and gradle 8.
Reference :
Komentar
Posting Komentar