共计 1628 个字符,预计需要花费 5 分钟才能阅读完成。
问题 1: 按照官网添加 link 后运行报错
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ‘:react-native-yunpeng-alipay’.
> Could not resolve all artifacts for configuration ‘:react-native-yunpeng-alipay:classpath’.
> Could not resolve com.android.tools.build:gradle:1.3.1.
Required by:
project :react-native-yunpeng-alipay
> Could not resolve com.android.tools.build:gradle:1.3.1.
> Could not get resource ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom’.
> Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.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.android.tools.build:gradle:1.3.1.
> Could not get resource ‘https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom’.
> Could not GET ‘https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom’.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.
解决办法修改 react-native-yunpeng-alipay 下的 build.gradle 文件
buildscript {
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
// classpath ‘com.android.tools.build:gradle:1.3.1’
classpath ‘com.android.tools.build:gradle:3.2.1’
}
}
修改 com.android.tools.build:gradle:1.3.1 和项目 android 的版本保持一致添加 mavenLocal() google() 重新运行,问题解决