React-native 集成react-native-yunpeng-alipay 爬坑

貌似掉线 2019-07-01

问题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()
重新运行 ,问题解决

相关推荐