React Native 0.66.4 安卓编译报错Failed to transform react-native-0.71.0-rc.0-debug.aar

以前好用的项目,现在运行react-native run-android报错Failed to transform react-native-0.71.0-rc.0-debug.aar

报错截图如下:


解决方法:

在android/bulid.gradle文件增加以下内容

def REACT_NATIVE_VERSION = new File(['node','--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

configurations.all {

resolutionStrategy {

// Remove this override in 0.66, as a proper fix is included in react-native itself.

force"com.facebook.react:react-native:" + REACT_NATIVE_VERSION

}

}


!!!注意:原来的0.59.5项目也不好用了,但是报错不同,用此方法解决!!!!

报错如下:





参考:https://blog.csdn.net/ln1010/article/details/127728431

你可能感兴趣的:(React Native 0.66.4 安卓编译报错Failed to transform react-native-0.71.0-rc.0-debug.aar)