React-Native執行報錯問題彙總 以及Taro小程式異常

HappyCodingTop發表於2021-12-24

RN

1.本地打包失敗,缺少sentry配置

image.png
註釋
image.png

2.執行pod install的時候,use_native_modules 找不到本地的包

image.png
手動修改@react-native-commutiy下的包的路徑 找到這個包下的bin.js本地的路徑
image.png

3.執行yarn android的時候報錯

image.png
手動修改android目錄下的build.gradle檔案,新增
image.png

4.執行yarn android的時候報錯

image.png
手動複製jdk檔案地址(注意替換為自己的地址)

sudo cp /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/lib/tools.jar /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib

5.執行yarn android的時候報錯

image.png
手動修改android下的compileSdkVersion和targetSdkVeision為29
image.png

6.執行yarn android的時候報錯 cannot find moudle react-native-pager-view at @ant-design/react-native/lib/carousel

手動安裝react-native-pager-view

7執行yarn start的時候報錯,找不到模組

image.png
手動安裝@react-native-picker

8APP拉起小程式支付後無法返回APP

https://developers.weixin.qq.... 此介面使用者可手動觸發返回App 只能返回拉起小程式的App

9react-native-image-picker 502

image.png
手動註釋android/build.gradle中圈中的部分
image.png

10 maven { url 'https://dl.bintray.com/umsdk/...' } 訪問不了

image.png

按圖示中替換maven { url 'https://repo1.maven.org/maven2/' }
image.png

11 RN 圖片不顯示

xcode12導致  在檔案react-native/Libraries/Image/RCTUIImageViewAnimated.m中的

if (_currentFrame) {...}後加

else {

[super displayLayer:layer];

}

12 升級到最新的mac 系統 monterey, xcode 13,執行yarn ios報錯

image.png
解決方法
image.png

13 Xcode報錯An organization slug is required (provide with --org)

企業微信截圖_537845f3-7664-46f0-9eba-15485d450429.png
在ios檔案下新建sentry.properties檔案

defaults.project=sentry新建的具體專案名
defaults.org=組織名 // 比如https://sentry.xxxx.com/organizations/sentry1111/projects/,組織名為sentry1111
defaults.url=https://sentry.xxxx.com // 私有化部署sentry的,取自己域名;走官方sentry的該值不需要配置,直接刪除
auth.token=authtoken // 這個值的獲取比較麻煩, 私有化參照下面步驟獲取,官方的應該走專案設定直接能生成

14 如果Xcode點選這個檔案執行不起來

企業微信截圖_2430d6a1-0069-4c8e-92d6-3668c172cd31.png


1. 可以在ios資料夾下執行yarn start
2. 在專案的最外層執行 yarn run ios

Taro

15 專案編譯小程式報錯

taro相關依賴 要與taro-cli保持一致

16 修改tabbar尺寸

app.less中直接修改.weui-tabbar__icon的寬高

17 進入列表頁閃屏

重新返回列表頁的生命週期
componentDidShow 只用來init

在程式切後臺生命週期

componentDidHide中重置查詢引數(包括loading引數)

18 開發環境小程式啟動白屏

src/app.config.ts

底部plugins中存在未授權外掛 註釋掉即可

19 微信開發者工具執行會出現白屏,編譯失敗

image.png
升級系統,升級微信開發者工具

20 啟動後 跳轉頁面報錯 空頁面

image.png
升級微信開發者工具

相關文章