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

問題1:按照官網添加link後運行報錯react

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文件android

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()
從新運行 ,問題解決react-native

相關文章
相關標籤/搜索