问题:集成后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.重新打包

附图:修改后的代码