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

Error webview ionic plugin android-targetSdkVersion 30 #663

Open
ghost opened this issue Feb 18, 2022 · 1 comment
Open

Error webview ionic plugin android-targetSdkVersion 30 #663

ghost opened this issue Feb 18, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 18, 2022

We are having a problem generating our android ionic application. We need to update the android-targetSdkVersion to 30 and we want to do it without losing the localstorage data. When we run the command

sudo ionic cordova build android --release --prod

We get this error

> Task :app:compileReleaseJavaWithJavac FAILED
    …platforms/android/app/src/main/java/com/ionicframework/cordova/webview/IonicWebViewEngine.java:11: error: package android.support.annotation does not exist
    import android.support.annotation.RequiresApi;

    …platforms/android/app/src/main/java/com/ionicframework/cordova/webview/IonicWebViewEngine.java:114: error: cannot find symbol
     @RequiresApi(Build.VERSION_CODES.LOLLIPOP)

    symbol:   class RequiresApi
    location: class com.ionicframework.cordova.webview.IonicWebViewEngine.ServerClient
    Note: …/platforms/android/app/src/main/java/com/ionicframework/cordova/webview/IonicWebViewEngine.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors

We currently use the plugin plugin-cordova-ionic-webview 2.5.2.

Upgrading to version 5.X of the plugin fixes the bug and allows the build to be generated but causes the localstorage to be deleted so it is discarded. (Upgrading from version 2.X to 3.X or higher deletes the localstorage).
We opted to comment out the lines that cause this error. That way it does allow to generate the build but it also deletes the localstorage data, which makes us think that the deletion could also be from updating the android-targetSdkVersion.
Given this situation we would like to know if there is a way to update the android-targetSdkVersion to 30 without affecting the localStorage.

@Joakiru
Copy link

Joakiru commented Jan 20, 2023

Delete only what you don't use, then install the following library

https://github.com/dpa99c/cordova-plugin-androidx-adapter

With 'ionic cordova plugin add cordova-plugin-androidx-adapter'.

This saved my project
Best regards.

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

1 participant