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

Reorgnize plugin migration guide #173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 50 additions & 56 deletions docs/main/updating/plugins/5-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,19 @@ From the plugin folder, run `npx @capacitor/plugin-migration-v4-to-v5@latest` an

Update `@capacitor/cli`, `@capacitor/core`, `@capacitor/android` and `@capacitor/ios` to `next` version.

### Updating targetSDK / compileSDK to 33
```diff
# build.gradle
### Updating build.gradle

Update the targetSDK / compileSDK to 33:

```diff
android {
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
```

### Update Android Plugin Variables

In your `build.gradle` file, update the following package version minimums:
Update the Android Plugin minimum version variables:

```diff
ext {
Expand All @@ -59,7 +58,7 @@ ext {
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
```

### Update gradle plugin to 8.0.0
Update the gradle plugin to 8.0.0:

```diff
dependencies {
Expand All @@ -68,80 +67,75 @@ ext {
}
```

### Update gradle wrapper to 8.0.2
Update to Java 17:

```diff
# gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
compileOptions {
- sourceCompatibility JavaVersion.VERSION_11
+ sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_17
}
```

### Move package to `build.gradle`
Update `kotlin_version` **if your plugin uses kotlin**:

```diff
# AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="[YOUR_PACKAGE_ID]">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
buildscript {
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.7.0'
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
repositories {
```

And replace `org.jetbrains.kotlin:kotlin-stdlib-jdk7` or `org.jetbrains.kotlin:kotlin-stdlib-jdk8` dependencies with `org.jetbrains.kotlin:kotlin-stdlib`.


```diff
# build.gradle
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
```

android {
+ namespace "[YOUR_PACKAGE_ID]"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
### Updating gradle-wrapper.properties:

Update gradle wrapper to 8.0.2:

```diff
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
```

### Disable Jetifier
### Updating gradle.properties

```diff
# gradle.properties
Disable Jetifier:

```diff
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
- # Automatically convert third-party libraries to use AndroidX
- android.enableJetifier=true
```

### Update to Java 17

```diff
# build.gradle
compileOptions {
- sourceCompatibility JavaVersion.VERSION_11
+ sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_17
}
```
### Moving the package to `build.gradle`

### Update kotlin_version

If your plugin uses kotlin, update the default `kotlin_version`
In **AndroidManifest.xml**:

```diff
# build.gradle
buildscript {
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.7.0'
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
repositories {
<?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="[YOUR_PACKAGE_ID]">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
```

And replace `org.jetbrains.kotlin:kotlin-stdlib-jdk7` or `org.jetbrains.kotlin:kotlin-stdlib-jdk8` dependencies with `org.jetbrains.kotlin:kotlin-stdlib`.

In **build.gradle**:

```diff
# build.gradle
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
```
android {
+ namespace "[YOUR_PACKAGE_ID]"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
```