I tried again (npm i -D @capacitor/cli@latest and npx cap migrate).
These were the errors:
Upgrading gradle wrapper files - failed!
[error] gradle wrapper files were not updated
[info] IMPORTANT: Review Updating to 4.0 | Capacitor Documentation for breaking changes in these plugins that
you use: @capacitor/storage.
[info] Warning: The Android Gradle plugin was updated and it requires Java 11 to run. You may need to select this in
Android Studio.
Installing Latest NPM Modules. - failed!
[error] npm install failed. Try deleting node_modules folder and running npm install --force manually.
[info] NOTE: @capacitor/storage was renamed to @capacitor/preferences, please be sure to replace occurances in your
code.
Migrating @capacitor/storage to @capacitor/preferences. - failed!
[error] @capacitor/preferences failed to install. Try deleting node_modules folder and running npm install
@capacitor/preferences --force manually.
Thus, I followed this steps:
- delete package-lock.json file.
- package.json file has been changed: “capacitor-video-player”: “^4.6.2-3”,
- storage.services file has been changed :
import { Preferences } from ‘@capacitor/preferences’;
…
async setString(key: string, value: string) {
await Preferences.set({ key, value });
}
…
It was: import { Storage } from ‘@capacitor/storage’; …
- The steps listed on the site (Updating to 4.0 | Capacitor Documentation) for Android already were correct (-Using Java 11, -Add
android:exported
tag to your Android Manifest, -Update Gradle Google Services plugin, -Update to Gradle), except: Update Android Project Variables
Thus, variables.gradle file has been updated.
After this steps, Android Studio (Build, Generate Signed Bundle / APK) built SDK level 32.