Skip to content

fishg/YoumeSDKRNDemo

Repository files navigation

RN新工程导入插件配置说明

创建一个新的工程

#创建新工程
react-native init YoumeSDKRNDemo

配置Android 插件

  • Android Studio 需要安装NDK
  • 拷贝SDK文件夹到工程根目录,本Demo是在YoumeSDKRNDemo/SDK
  • 拷贝yimrn 文件夹到android工程根目录,本Demo是在YoumeSDKRNDemo/android/yimrn
  • 拷贝CMakeLists.txtandroid/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);
  }