更新react native 时发现几个错误,记录一下:
1.出现错误提示,内容为 “Unrecognized font family ‘antoutline’,这是因为用了AntDesign Mobile 的UI组件的缘故。
解决方法:
- 进入 node_modules/@ant-design/icons-react-native/fonts 目录, 制
antfill.ttf
和antoutline.ttf
到Xcode Project -> Resources folder
. - 两个文件 添加到
info.plist
->Fonts provided by application
配置中。
<key>UIAppFonts</key>
<array>
<string>antfill.ttf</string>
<string>antoutline.ttf</string>
</array>
二.编译时遇到Duplicate resources – Android
// Create dirs if they are not there (e.g. the “clean” task just ran)
doFirst {
jsBundleDir.deleteDir()
jsBundleDir.mkdirs()
resourcesDir.deleteDir()
resourcesDir.mkdirs()
jsIntermediateSourceMapsDir.deleteDir()
jsIntermediateSourceMapsDir.mkdirs()
jsSourceMapsDir.deleteDir()
jsSourceMapsDir.mkdirs()
}
//添加
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()
}