React本机版本0.47.1构建失败错误:com.facebook.react:react-native:0.47.1无法解析com.squareup.okhttp3:okhttp:3.6.0
问题描述:
我更新了react-native到最新版本(0.47 .1),然后初始化一个新的react-native项目,但根本无法运行它。 okhttp3有一个SSL问题,我没有单独安装它。我在此文件夹中存在的cacerts文件中添加了证书:C:\Program Files\Java\jre7\lib\security
;但仍然有问题。React本机版本0.47.1构建失败错误:com.facebook.react:react-native:0.47.1无法解析com.squareup.okhttp3:okhttp:3.6.0
这是堆栈跟踪:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.squareup.okhttp3:okhttp:3.6.0.
Required by:
Limo:app:unspecified > com.facebook.react:react-native:0.47.1
> Could not resolve com.squareup.okhttp3:okhttp:3.6.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.6.0/okhttp-3.6.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.6.0/okhttp-3.6.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve com.squareup.okhttp3:okhttp-urlconnection:3.6.0.
Required by:
Limo:app:unspecified > com.facebook.react:react-native:0.47.1
> Could not resolve com.squareup.okhttp3:okhttp-urlconnection:3.6.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/3.6.0/okhttp-urlconnection-3.6.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/3.6.0/okhttp-urlconnection-3.6.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve com.squareup.okio:okio:1.13.0.
Required by:
Limo:app:unspecified > com.facebook.react:react-native:0.47.1
> Could not resolve com.squareup.okio:okio:1.13.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/squareup/okio/okio/1.13.0/okio-1.13.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/squareup/okio/okio/1.13.0/okio-1.13.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve com.squareup.okhttp3:okhttp:3.6.0.
Required by:
Limo:app:unspecified > com.facebook.react:react-native:0.47.1 > com.facebook.fresco:imagepipeline-okhttp3:1.0.1
> Could not resolve com.squareup.okhttp3:okhttp:3.6.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.6.0/okhttp-3.6.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.6.0/okhttp-3.6.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我使用jre7,Android Studio中1.5和1.5.0的gradle。 是否存在兼容性问题?
谢谢
答
愚蠢的问题!看起来JVM不会仅仅通过重新启动adb来重新加载cacerts文件,虽然它在adb重新启动后包含在证书列表中。但是需要重新启动系统才能删除ssl错误。