1.react-native run-android報(bào)錯(cuò)
Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html
1.確認(rèn)模擬器是否啟動(dòng)
2.模擬器狀態(tài)是否正常
3.真機(jī)是否連接好
下圖為模擬器正常狀態(tài)
下圖就是錯(cuò)誤狀態(tài)
2.SyntaxError /user/Destop/xxxx.js:Unexpected token(80:8)
報(bào)錯(cuò)信息
報(bào)錯(cuò)代碼:
原因:多了一個(gè) > 號(hào),這種報(bào)錯(cuò)一般需要自己檢查一下代碼,一般可能是多了一個(gè)
: } >
3.CFBundle identifier xxnot found
網(wǎng)絡(luò)不好的情況下,rncash包沒有下載好,建議多試幾次
4.application has not been registered
1.:MainActivity.java
檢查的項(xiàng)目名稱與index.android.js
文件里的項(xiàng)目名稱是否相同
2:是否同時(shí)開啟了兩個(gè)項(xiàng)目
5.:unable to load script from assets 'index.android bundle' ,make sure your bundle is packaged correctly or youu're runing a packager server
錯(cuò)誤如下圖:
修改方法:
在終端進(jìn)入到當(dāng)前文件目錄下,輸入:
1.mkdir android/app/src/main/assets
(如果提示:mkdir: android/app/src/main/assets: File exists
可直接執(zhí)行第二步)
2.react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
6.SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
在當(dāng)前文件夾下查看是否有local.properties
這個(gè)文件,如果沒有就創(chuàng)建一個(gè)
下圖示例:
7. A problem occurred configuring project ':app'. > failed to find Build Tools revision 23.0.1
當(dāng)我在終端react-native run-android
時(shí)報(bào)了上述錯(cuò)誤,修改方法為:進(jìn)入到android/app/build.gradle
將buildToolsVersion
改成所提示版本
下圖為正確示例:
8.no bundle URL present
請(qǐng)檢查是否打開了兩個(gè)項(xiàng)目/模擬器,先全部退出,在再終端輸入:react-native run-ios
報(bào)錯(cuò)如圖:
9.Super expression must either be null or a function
這種一般是代碼寫錯(cuò)了,需要仔細(xì)檢查自己的代碼,錯(cuò)誤圖例如下