不支持Android Studio 3编译
Error:Execution failed for task ':react-native-update:compileDebugNdk'.
Error: Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version of Android Studio. Please switch to a supported build system.
Consider using CMake or ndk-build integration. For more information, go to:
https://d.android.com/r/studio-ui/add-native-code.html#ndkCompile
To get started, you can use the sample ndk-build script the Android
plugin generated for you at:
/Users/duguying/code/opsapp/node_modules/react-native-update/android/build/intermediates/ndk/debug/Android.mk
Alternatively, you can use the experimental plugin:
https://developer.android.com/r/tools/experimental-plugin.html
To continue using the deprecated NDK compile for another 60 days, set
android.deprecatedNdkCompileLease=1509345866453 in gradle.properties
解决方法
https://github.com/midas-gufei/react-native-pushy
已经更新CMakeLists.txt,支持as3.0.
安装使用
- 详细文档请访问 react-native-pushy
- android studio3.0环境下的build配置如下:
- 删除主工程android/gradle.properties中的android.useDeprecatedNdk=true,没添加的忽略
- 将android/src/main/jni目录改为android/src/main/cpp
- 拷贝CMakeLists.txt到android目录下
- 覆盖android/build.gradle文件
- 点击AndroidStudio工具栏的build/Make Project,在android/build/intermediates/cmake自动生成对应的so文件
- 不想配置ndk环境自己编译.so的文件童鞋,可以在android/libs/cmake目录下载编译好的so文件直接使用。