React Native:The development server returned response error code: 404 || version mismatch

The development server returned response error code: 404

React Native:The development server returned response error code: 404 || version mismatch

::ffff:127.0.0.1 - - [15/May/2018:09:49:13 +0000] "GET /index.android.delta?platform=android&dev=true&minify=false HTTP/1.1" 404 79 "-" "okhttp/3.6.0"

或者
React Native:The development server returned response error code: 404 || version mismatch


解决方法:

打开android/app/build.gradle

compile 'com.facebook.react:react-native:+'
修改为:
compile ("com.facebook.react:react-native:0.47.1") { force = true }
0.47.1替换你自己的react-native版本号

新版本的gradle 不锁定react-natvie版本导致的


原因:

Once each repository has been inspected for the module, Gradle will choose the 'best' one to use. This is done using the following criteria:

For a dynamic version, a 'higher' concrete version is preferred over a 'lower' version.

Modules declared by a module metadata file (.module, .pom or ivy.xml file) are preferred over modules that have an artifact file only.

Modules from earlier repositories are preferred over modules in later repositories.

When the dependency is declared by a concrete version and a module metadata file is found in a repository, there is no need to continue searching later repositories and the remainder of the process is short-circuited.

Source: https://docs.gradle.org/current/userguide/introduction_dependency_management.html#sec:dependency_resolution

参考:https://github.com/facebook/react-native/issues/19259