打包报错
React-native-webview
- 找到工程目录下/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
- 注释掉此方法
public void setWebChromeClient(WebChromeClient client) {
this.mWebChromeClient = client;
super.setWebChromeClient(client);
}
- 找不到符号,Android.Q 解决办法是:把android Q改为28
所有的依赖库如果报错 not found supportv4 如:
/Users/daaijinxiao/Desktop/dajx/dajx_client/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/GetuiModule.java:5: 错误: 程序包android.support.annotation不存在 import android.support.annotation.Nullable; 参考:https://bin.zmide.com/?p=337/
- 导入包名修改为androidx.annotation
- 将报错的库改为import androidx.annotation.xxxx;
React-native-swpier
- 找到路径/node_modules/react-native-swiper/src/index.js
- index.js文件第775行改为 contentoffset={this.fullstate().offset}
react-native-orientation:verifyReleaseResources FAILE
- 找到/android/build.gradle 的build.gradle文件
- 做以下修改
targetSdkVersion 28
compileSdkVersion 28
buildToolsVersion "28.0.0"
react-native-picker:verifyReleaseResources FAILED
- 找到/android/build.gradle 的build.gradle文件
- 做以下修改
targetSdkVersion 28
compileSdkVersion 28
buildToolsVersion "28.0.0"
app:bundleReleaseJsAndAssets FAILED
- 尝试了诸多办法最终在此处解决(不敢保证一定能行,但可以尝试) https://www.jianshu.com/p/ab7aff974d11
其他报错
@react-native-community/toolbar-android红屏
- 报错如下: Unable to resolve module @react-native-community/toolbar-android from node_modules/react-native-vector-icons/lib/toolbar-android.js: @react-native-community/toolbar-android could not be found within the project jing
- 解决办法: https://stackoverflow.com/questions/62769564/error-unable-to-resolve-module-react-native-community-toolbar-android
> Task :app:bundleReleaseJsAndAssets FAILED
- 解决办法: https://stackoverflow.com/questions/49513047/react-native-assemblerelease-fails-for-task-appbundlereleasejsandassets 1、根目录执行 react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res 2、cd android 目录执行 ./gradlew assembleRelease -x bundleReleaseJsAndAssets
Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect
1、出现的场景,使用SS设置了全局代理,然后在Android Studio中设置了代理,然后将Android Studio代理关闭之后,还是发现上不了网。出现了这个错误。
解决: 找到.gradle文件夹下的gradle.properties 文件,将末尾的代理取消掉。
注:gradle.properties并非是项目中的文件,而是本地gradle中的文件。比如mac电脑是用户目录下.gradle文件夹中。 mac下该文件为隐藏文件,大家自行改为可见文件。
2、参考链接 https://blog.csdn.net/u011368551/article/details/84309829