React Native Android Release Build Failing - Gradle

后端 未结 2 1811
南旧
南旧 2021-02-04 12:34

I\'ve got a rather complicated project some of which is older code from the past year or so which in React Native time is forever. The regular debug build is working fine but th

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 13:03

    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.

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

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

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

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

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

    Edit: 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.

提交回复
热议问题