1.替换原read.js
文件和proguard-rules.pro
文件
2.将audio
文件夹放到reactasome
目录下
android/src/main/java/com/reactasome/audio
3.在MainApplication.java
中加入
import com.siboEnglish.audio.RecognizerPackage;
packages.add(new RecognizerPackage());
4.修改 app/build.gradle
def enableProguardInReleaseBuilds = false
5.在android/build.gradle
中两个repositories
首行加入:
mavenCentral()
6.在viewpager.js
加入权限申请
UNSAFE_componentWillMount() {
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE).then(res => { })
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO).then(res => { })
}
7.安装第三方库react-native-ffmpeg
yarn add react-native-ffmpeg
如果项目启动时该库报错,修改该库中
build.gradle
,在repositories
中加入:
maven { url ‘https://maven.aliyun.com/repository/google’ }
maven { url ‘https://maven.aliyun.com/repository/jcenter’ }