Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.support.v4.app does not exist

..../cordova/sms_receiver/SmsReceiverPlugin.java:8: error: package android.support.v4.app does not exist import android.support.v4.content.ContextCompat;

also:

..../cordova/sms_receiver/SmsReceiverPlugin.java:121: error: cannot find symbol ActivityCompat.requestPermissions(this.cordova.getActivity(), new String[]{type}, requestCode);

and:

..../cordova/sms_receiver/SmsReceiver.java uses or overrides a deprecated API.

Driving me nuts. Trying to build a cordova app for android. I've followed a ton of different google results to try and get rid of this error.

Including adding this to plugin.xml:

<framework src="com.android.support:support-v4:+" />

also a reference to a build.gradle file with:

dependencies: {
    compile 'com.android.support:support-v4:+'
}

Also adding numerous paths to $PATH, selecting everything in Android SDK manager etc etc, nothing works!

New to this I'll admit, this is on a Mac with Java 1.8 JDK installed. Tried 10.0 also.

I've lost track of all the things I've tried. Please can someone put me out of my misery.

like image 309
user4893295 Avatar asked Jun 14 '26 00:06

user4893295


2 Answers

You can probably solve your issue by adding the plugin :

https://www.npmjs.com/package/cordova-plugin-android-support-v4

as mentioned here - https://github.com/rehy/cordova-plugin-sms-receiver/issues/7

like image 176
Keerthi Avatar answered Jun 15 '26 14:06

Keerthi


Change and import androidx.core.content.FileProvider;

Otherwise

  1. npm install jetifier

  2. npx jetify

  3. npx cap sync android

if your project on native

like image 31
Chintan Vasoya Avatar answered Jun 15 '26 13:06

Chintan Vasoya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!