#创建新工程
react-native init YoumeSDKRNDemo
- Android Studio 需要安装NDK
- 拷贝
SDK
文件夹到工程根目录,本Demo是在YoumeSDKRNDemo/SDK
- 拷贝
yimrn
文件夹到android工程根目录,本Demo是在YoumeSDKRNDemo/android/yimrn
- 拷贝
CMakeLists.txt
到android/app/CMakeLists.txt
- 修改
android/app/build.gradle
,在defaultConfig
段的末尾添加:
ndk {
abiFilters "armeabi-v7a", "x86"
}
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -llog"
arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_STL=c++_static"
}
}
- 修改
android/app/build.gradle
,在defaultConfig
段的平级添加:
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
- 修改
android/app/build.gradle
,在dependencies
添加:
implementation project(':yimrn')
-
修改
android/settings.gradle
,在include ':app'
前添加:include ':yimrn'
-
在
MainApplication.java
中添加插件注册:
packages.add(new DjinniModulesPackage());
- 在
MainActivity.java
添加游密so加载代码:
@Override
protected void onCreate(Bundle savedInstanceState){
IMEngine.init(this);
YouMeManager.Init(this);
super.onCreate(savedInstanceState);
}