diegosiao / cordova-plugin-android-sms-retriever

A plugin compliant with SMS Retriever Android API to receive text messages without requiring SMS permissions
7 stars 10 forks source link

Not working with Cordova 10, #5

Open razin223 opened 2 years ago

razin223 commented 2 years ago

I was using this plugin for a long time (since 2018). Recently due to google play store compliance, I've to update to Cordova 10 for Google SDK api version 30.0.3. Since then this plugin is not working when I'm trying to build the app for release. I did not check what would happened if I try to make debug version. Here is my error when building release version.

Task :app:compileReleaseJavaWithJavac FAILED

E:\Cordova_App\jahaji.ltd.app\platforms\android\app\src\main\java\org\cordova\plugin\android\sms\retriever\cordova-plugin-android-sms-retriever\CordovaPluginAndroidSmsRetriever.java:8: error: package android.support.annotation does not exist import android.support.annotation.NonNull; ^ E:\Cordova_App\jahaji.ltd.app\platforms\android\app\src\main\java\org\cordova\plugin\android\sms\retriever\cordova-plugin-android-sms-retriever\CordovaPluginAndroidSmsRetriever.java:111: error: cannot find symbol public void onFailure(@NonNull Exception e) { ^ symbol: class NonNull Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors

FAILURE: Build failed with an exception.

Please help us.

diegosiao commented 2 years ago

Please, send if possible the last successful Android SDK version you've built against.

victor-sanchez-ccc commented 1 year ago

@razin223 If you use android x , this plugin do not support android x yet, you need to replace import android.support.annotation.NonNull;, whit import androidx.annotation.NonNull; in CordovaPluginAndroidSmsRetriever.java file.

diegosiao commented 1 year ago

@victor-sanchez-ccc could you kindly submit a PR to this?

victor-sanchez-ccc commented 1 year ago

image

@diegosiao i don't know if a pr its the best solutions to fix this, because this only works with android x , this change brake another implementations without android x, in old cordova projects.

the previus image show the change i mentioned in te coment before and is not complex to do.

In the same way I leave the fork of the project that I make and use in my project so that it is compatible with androidx

Currently in my project I use the following configuration in cordova Android 11 and the plugin works correctly

  "MIN_SDK_VERSION": 22,
  "SDK_VERSION": 32,
  "GRADLE_VERSION": "7.4.2",
  "MIN_BUILD_TOOLS_VERSION": "32.0.0",
  "AGP_VERSION": "7.2.1",
  "KOTLIN_VERSION": "1.6.20",
  "ANDROIDX_APP_COMPAT_VERSION": "1.4.2",
  "ANDROIDX_WEBKIT_VERSION": "1.4.0",
  "ANDROIDX_CORE_SPLASHSCREEN_VERSION": "1.0.0-rc01",
  "IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": true,
  "IS_GRADLE_PLUGIN_KOTLIN_ENABLED": true