Monday, September 30, 2019

Error: cannot find symbol import android.support.v4.app.ActivityCompat

Having same problem like i had?

node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:30: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app

Or something looks similar that saying xxx.v4.app.ActivityCompat?
Well here is the SO, the solution is to jetify.

Use this :
step 1: add these two lines in gradlew.properties Visit for complete guideline
android.useAndroidX=true
android.enableJetifier=true
step 2: use these commands
First of all remove node_modules folder and reinstall it using
npm install 
or
yarn
and then
npm install --save-dev jetifier 
npx jetify  
npx react-native run-android 
Call
npx jetify
Happy coding ^^

No comments: