Reactnative-集成reactnativegetui-爬坑

9次阅读

共计 565 个字符,预计需要花费 2 分钟才能阅读完成。

问题: 集成后 react-native run-android 可以运行,但是打包的时候报错。

解决方法

修改 react-native-getui 包下面 android 目录下的 build.gradle

1. 首先在 node_modules 中找到报错的包里面的 build.gradle,比如我这个就是 node_modulesreact-native-getuiandroidbuild.gradle;
2. 修改这个 build.gradle,使其与 android/build.gradle(也可能是 android/app/build.gradle)里面的 SDK 版本保持一致

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"

    ...

}

3. 将 build.gradle 里的 compile 改为 implementation,因为 compile 已过时。

dependencies {implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:support-v4:25+'
    implementation 'com.facebook.react:react-native:+'
}

4. 重新打包

附图:修改后的代码

正文完
 0