jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 539 forks source link

错误: 程序包android.support.v4.content不存在 #368

Open MelodyYM opened 4 years ago

MelodyYM commented 4 years ago

Version

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

react-native-audio :
react-native : react :
using react-native-sound ? Yes/No

Expected behaviour :

What were you trying to do and what did you expect to happen ?

Actual behaviour

What happened when your issue occurred ? The more details you provide here the better the odds are that someone will help you resolve your issue

Steps to reproduce

Please provide us with some code that we can run to reproduce your error.

Link to a git repo that reproduces bug

If you put a GitHub repo that reproduces your issue then you significantly increase your chances of getting help !

inkCrazy commented 4 years ago

+1, "react-native-audio": "^4.3.0", "react": "16.11.0", "react-native": "0.62.2",

/Users/inkcrazy/Documents/Daling062/node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:30: 错误: 找不到符号
import android.support.v4.app.ActivityCompat;
                             ^
  符号:   类 ActivityCompat
  位置: 程序包 android.support.v4.app
/Users/inkcrazy/Documents/Daling062/node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:31: 错误: 程序包android.support.v4.content不存在
import android.support.v4.content.ContextCompat;
                                 ^
/Users/inkcrazy/Documents/Daling062/node_modules/react-native-audio/android/src/main/java/com/rnim/rn/audio/AudioRecorderManager.java:105: 错误: 找不到符号
    int permissionCheck = ContextCompat.checkSelfPermission(getCurrentActivity(),
                          ^
  符号:   变量 ContextCompat
  位置: 类 AudioRecorderManager
3 个错误
inkCrazy commented 4 years ago

麻烦同步发布一下版本4.3.1到npm

inkCrazy commented 4 years ago

用了yarn add https://github.com/jsierles/react-native-audio.git这个方法解决了

inkCrazy commented 4 years ago

作者GitHub更新4.3.1,虽然作者修改了gradle文件,但是AudioRecorderManager文件还是有问题,需要手动修改。 import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; 手动修改一下: import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat;