且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

React Native Android版本构建失败-Gradle

更新时间:2022-04-09 09:51:01

为我解决此问题的方法是,深入研究触发错误的支持库的node_modules代码.

The way to solve this that worked for me is to dive into the node_modules code for the supporting libraries that are triggering the error.

您将需要进入node_modules/project-name/android/build.gradle并进行更改

You will need to go into node_modules/project-name/android/build.gradle and change this

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    ...
}

到/android/app/build.gradle中的sdk版本. 例如:

to whatever the sdk version is in your /android/app/build.gradle is. For example:

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.1"
    ...
}

希望这将在React Native中修复,因此不需要此解决方法.

Hopefully this will be fixed in React Native so this workaround isn't necessary.

我怀疑Petter的解决方案是更好的解决方案,尽管我自己还没有尝试过.可能先尝试一个,如果不起作用,请尝试下一个.

I suspect Petter's solution is the better one although I haven't tried it myself. Probably try that one first and if it doesn't work, try this next.