hanatharesh2712 / ionic-native-sms-retriever-plugin-master

Cross-platform plugin for Cordova / PhoneGap to Retrieve SMS. Available for Android.
27 stars 18 forks source link

Unable to build after migrating from Cordova to Capacitor #24

Closed aravindsnkr2 closed 3 years ago

aravindsnkr2 commented 3 years ago

I was using this plugin in our Ionic 3 app and it was working. We decided to migrate to capacitor from cordova and after migration the build fails if this plugin is installed.

Here is the error output Android Studio shows :

/Users/username/android-app/android/capacitor-cordova-android-plugins/src/main/java/com/codingsans/ionic/smsRetriever/AndroidSmsRetriever.java:14: error: package android.support.annotation does not exist import android.support.annotation.NonNull; ^ /Users/username/android-app/android/capacitor-cordova-android-plugins/src/main/java/com/codingsans/ionic/smsRetriever/AndroidSmsRetriever.java:161: error: cannot find symbol public void onFailure(@NonNull Exception e) { ^ symbol: class NonNull

We are planning to migrate to Ionic 4 and then to 5 if the capacitor migration is successful.

hanatharesh2712 commented 3 years ago

@aravindsnkr2 Check this working example with a capacitor. https://github.com/ClickerVinod/Ionic4AutoOTPVerify

karen1au commented 3 years ago

I'm having the same error, the gradle file looks similar to the working example

enemlk commented 3 years ago

https://capacitorjs.com/docs/android/troubleshooting

Error: “package android.support.* does not exist” This error occurs when some Cordova or Capacitor plugin has old android support dependencies instead of using the new AndroidX equivalent. You should report the issue in the plugin repository so the maintainers can update the plugin to use AndroidX dependencies.

As a workaround, you can also patch the plugin using jetifier:

npm install jetifier npx jetify npx cap sync android

aless673 commented 3 years ago

You should rather install this plugin : cordova-androidx-build to make it build without error