-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Gradle
-
The SDK Build Tools revision (23.0.1) is too low for project ':aliyun-oss-react-native-sdk'. Minimum required is 25.0.0
第三方库使用的buildToolsVersion版本太低,不需要手动修改库内容,在android/build.gradle中添加以下内容,强制所有依赖使用相同版本。
subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { compileSdkVersion 26 buildToolsVersion '26.0.3' } } } }
-
Could not find method google() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.
这个问题的本质是gradle版本过低
可通过手动修改第三方库build.gradle文件,把google()函数替换为maven链接 maven{url
'http://maven.aliyun.com/nexus/service/local/repositories/google/content/'}
或者升级gradle版本到3.0之上,就不用改第三方库了 -
Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
gradle 版本太低,只能通过升级gradle版本解决
https://gist.github.com/nazrdogan/87c63e89a2bfd4cefee24990e4e7ed0e -
uncompiled PNG file passed as argument. Must be compiled first into .flat file..
依赖库以及react-native对gradle3.0以上版本适配有问题,主要是高版本gradle使用Aapt2替换了Aapt打包应用资源。上面有依赖需要升级gradle版本到3.0,官方又对3.0依赖支持差。两种办法可以尝试把这个问题暂时绕过去
- CFKevinRef/react-native@78577cc 修改了react.gradle文件,支持aapt2。但是由于RN自身和众多第三方库不支持,该合并已经被React-native团队回退,没有带入到0.56版本。我们可以手动替换该文件。我试了下,遇到依赖资源重复的问题。
Better Android Gradle Plugin 3.x integration facebook/react-native#17967
Revert "Better Android Gradle Plugin 3.x integration" facebook/react-native#18189
众多大神吐槽 :)I wouldn't be surprised to see more people try out Flutter
- 或者配置 android.enableAapt2=false Android prod release - gradle tools 3 error react-navigation/react-navigation#3097
这个也会遇到资源重复
资源重复或使用gradle配置在打包时去掉重复资源,或者手动去掉重复资源,然后使用AndroidStudio打包。
- CFKevinRef/react-native@78577cc 修改了react.gradle文件,支持aapt2。但是由于RN自身和众多第三方库不支持,该合并已经被React-native团队回退,没有带入到0.56版本。我们可以手动替换该文件。我试了下,遇到依赖资源重复的问题。
-
Cannot merge new index 68188 into a non-jumbo instruction!
方法数量超过单dex上限
https://stackoverflow.com/questions/26093664/dexexception-cannot-merge-new-index-65536-into-a-non-jumbo-instruction
babel
-
Cannot read property 'bindings' of null
babel-preset-react-native 版本过低
After upgrading to React-Native 0.56 app doesn't start facebook/react-native#20042 -
comma issue
Node7 不再支持尾comma,{ temp, } 写法会报错,导致第三方库编译不过。
自己clone库,修改代码 -
react-native-modal编译不过
babel有bug,需要升级react-native-modal库规避
第三方依赖问题
- Unable to resolve module
react-native/Libraries/StyleSheet/normalizeColorfrom/home/supermario/Nodejs/test/fromScrach/Sinopec/node_modules/antd-mobile-rn/lib/segmented-control/segmented.android.js: Modulereact-native/Libraries/StyleSheet/normalizeColordoes not exist in the Haste module mapantd-mobile-rn 库使用了react-native弃用迁移的变量。最新版本的antd库就有问题,没法升级,我们会只有一个weldNew页面用到了SegmentedControl控件,可以考虑替换该控件。
运行时崩溃
-
react-native 的 自带Image控件
运行时崩溃。未找到原因。自此卡住
7.9号 灵感一现,继续
resizeMode={Image.resizeMode.cover} 替换为 resizeMode="cover" -
NavigationActions.reset undefined
NavigationActions库版升级导致的不兼容, reset 方法被移到新的StackActions中了
资源重复问题
- init一个新项目,一点一点把代码和依赖加进去,替换react.gardle,重新build,资源重复的问题消失了
- 看到旧项目中冲突的资源是drawable文件夹中以src开头的一些图片,推测是之前版本编译自动生成。全部删除
- 删除所有drawable-开头的资源文件夹,保留mipmap-开头的文件夹
遗留问题
- 由于antd-mobile-rn库在0.56中崩溃,weldNew中,需要替换掉SegmentedControl控件