jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.15k stars 536 forks source link

Couldn't findandroid.support.v4.app.ActivityCompat in React Native 0.59.1 #339

Open kiran-mantana opened 4 years ago

kiran-mantana commented 4 years ago

Version

Tell us which versions you are using ( you can see the versions in your package.json ):

react-native-audio : 4.2.2 react-native : 0.59.1 react : 16.4.1 using react-native-sound ? Yes/No No

Expected behaviour :

What were you trying to do and what did you expect to happen ? Migrated from 0.57 to 0.59.1 While trying to run the android (react-native run-android) I am getting the below error

Path/node_modules/react-native-audio/android/src/main/jav a/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 Path/node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:31: error: package android.support.v4.content does not exist import android.support.v4.content.ContextCompat; ^ Path/node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:105: error: cannot find symbol int permissionCheck = ContextCompat.checkSelfPermission(getCurrentActivity(), ^ symbol: variable ContextCompat

Actual behaviour

Not able to run the app

Steps to reproduce

gradle.properties android.useDeprecatedNdk=true android.enableAapt2=false

android.useAndroidX = true android.enableJetifier=true

package.json "@haskkor/react-native-pincode": "^1.7.4", "aws-amplify": "^1.1.9", "aws-appsync": "^1.3.4", "aws-appsync-react": "^1.1.4", "babel-polyfill": "^6.26.0", "buffer": "^5.2.1", "circular-json": "^0.5.7", "eslint": "^5.2.0", "eslint-config-airbnb": "^17.0.0", "eslint-config-prettier": "^2.9.0", "eslint-plugin-import": "^2.13.0", "eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-prettier": "^2.6.2", "eslint-plugin-react": "^7.10.0", "graphql-tag": "^2.7.3", "jest-expo": "~27.0.0", "lottie-ios": "3.0.3", "lottie-react-native": "3.1.0", "moment": "^2.22.2", "native-base": "^2.8.1", "prettier": "^1.13.7", "prop-types": "^15.6.2", "react": "16.4.1", "react-apollo": "^2.1.11", "react-native": "^0.59.1", "react-native-animatable": "^1.3.0", "react-native-audio": "4.2.2", "react-native-autolink": "^1.4.0", "react-native-background-upload": "^5.0.0", "react-native-blur": "^3.2.2", "react-native-brightcove-player": "^1.3.1", "react-native-calendars": "^1.21.0", "react-native-dialog": "^5.1.0", "react-native-document-picker": "^2.1.0", "react-native-elements": "^1.0.0-beta5", "react-native-exit-app": "^1.0.0", "react-native-fetch": "^2.0.0", "react-native-firebase": "^4.3.8", "react-native-flip-card": "^3.5.2", "react-native-fs": "^2.11.17", "react-native-google-analytics-bridge": "6.0.1", "react-native-highlight-words": "^1.0.1", "react-native-htmlview": "^0.13.0", "react-native-icon-badge": "^1.1.3", "react-native-image-crop-picker": "^0.21.3", "react-native-image-gallery": "^2.1.5", "react-native-image-picker": "^0.27.1", "react-native-interactable": "^0.1.10", "react-native-is-device-rooted": "^1.0.3", "react-native-loading-spinner-overlay": "^0.5.2", "react-native-mime-types": "^2.2.1", "react-native-modal": "^6.5.0", "react-native-modal-datetime-picker": "^6.0.0", "react-native-permissions": "^1.1.1", "react-native-popup-dialog": "^0.15.1", "react-native-progress": "^3.5.0", "react-native-progress-bar-animated": "^1.0.6", "react-native-search-filter": "^0.1.4", "react-native-searchable-list": "^1.1.3", "react-native-snap-carousel": "^3.7.2", "react-native-text-input-enhance": "^1.0.11", "react-native-touch-id": "^4.3.0", "react-native-uuid": "^1.4.9", "react-native-vector-icons": "^4.6.0", "react-native-video": "4.4.2", "react-native-video-controls": "^2.2.3", "react-native-wheel-picker-android": "^2.0.5", "react-native-wkwebview-reborn": "^2.0.0", "react-navigation": "^2.18.2", "react-redux": "^5.0.7", "redux": "^4.0.1", "redux-logger": "^3.0.6", "redux-persist": "^5.10.0", "redux-thunk": "^2.3.0", "rn-fetch-blob": "0.10.13" }, "devDependencies": { "@babel/plugin-external-helpers": "^7.2.0", "@babel/runtime": "^7.5.4", "babel-jest": "23.2.0", "babel-preset-react-native": "^5", "jest": "23.3.0", "metro-react-native-babel-preset": "^0.55.0", "react-test-renderer": "16.4.1", "schedule": "0.4.0" },

In build.gradle file ext { buildToolsVersion = "28.0.3" minSdkVersion = 19 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" }

repositories {
    jcenter()
    google()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'com.dynatrace.tools:android:+'

}

When run the app every time for Android getting the issue.

roninprogrammer commented 4 years ago

Need to Have androidX

Wbqqqq commented 4 years ago

@kiran-mantana hi ,do you solve this issue ,wo have same problem,😢😢😢

hunter-T1 commented 4 years ago

I think it works npm install --save-dev jetifier npx jetify

LucasMonteiro1 commented 4 years ago

Maybe PR #330 fixes that

bigkrys commented 4 years ago

npx jetify

not works!

Rileyp33 commented 4 years ago

In Android Studio, try Refactor > Migrate to AndroidX. If there is Java code referencing the old support libraries, it'll show which namespaces need to be updated -- click "Do Refactor." Then npx jetify, clean and rebuild.