底层项目与rn项目是分开的,也就是先存在项目然后集成的react-native
错误如下:
另一程序已锁定文件的一部分,进程无法访问。
打开react-native项目,找到node_modules\react-native\react.gradle文件
修改reactRoot,entryFile,inputExcludes等变量的路径
entryFile 中的index.android.js可能需要修改成为index.js
根据你文件名来选择是否需要修改
注意此时的两个文件夹同级
def cliPath = config.cliPath ?: "node_modules/react-native/cli.js"
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
def entryFile = config.entryFile ?: "index.js"
def bundleCommand = config.bundleCommand ?: "bundle"
def reactRoot = file(config.root ?: "../../severallessons-rn/")
def inputExcludes = config.inputExcludes ?: ["../severallessons-android/**", "ios/**"]
def bundleConfig = config.bundleConfig ? "${reactRoot}/${config.bundleConfig}" : null ;
重复资源(同文件加入)
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
if (originalDir.exists()) {
File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
}
}
moveFunc.curry("ldpi").call()
moveFunc.curry("mdpi").call()
moveFunc.curry("hdpi").call()
moveFunc.curry("xhdpi").call()
moveFunc.curry("xxhdpi").call()
moveFunc.curry("xxxhdpi").call()
}