react-native常见的坑

508 阅读1分钟

1.AndroidStudio Android Unknown failure: Can't find service: package

AVD Manager -> 选中的你的模拟器 -> 右键 -> Cold Boot Now

2.com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

// app build.gradle中设置 
defaultConfig {
    applicationId "xxx"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 208
    versionName '2.0.8'
    multiDexEnabled true // insert this line
}

3.Execution failed for task: app:processDebugResources

cd ./android && .\gradlew clean

4.Unable to resolve module” debuggerWorker errors in recent react-native releases

uninstalling manually app from device (cmd+H to display simulator home) then long click on app icon and click on cross to delete app => this forces disabling debug mode

5.app:compileDebugJavaWithJavac

// 查看详细debug信息cd ./android && ./gradlew compileDebugJavaWithJavac

6.react-native-vector-icons =====> Duplicate resources

react-native-vector-icons =====> Duplicate resources

7.react-native unable to load script

// 可能是端口被占用了。
netstat -ano|findstr '8081'
taskkill  /f /t /im pid