React-native 集成react-native-puti-pay 爬坑

問題1:按照官網後運行正常,第二次運行忽然報錯,讓人措手不及react

WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :app:checkDebugClasspath FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+.
  Required by:
      project :app > project :react-native-puti-pay
   > Failed to list versions for com.tencent.mm.opensdk:wechat-sdk-android-without-mta.
      > Unable to load Maven meta-data from https://jcenter.bintray.com/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml.
         > Could not HEAD 'https://jcenter.bintray.com/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml'.
            > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Failed to list versions for com.tencent.mm.opensdk:wechat-sdk-android-without-mta.
      > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Failed to list versions for com.tencent.mm.opensdk:wechat-sdk-android-without-mta.
      > Unable to load Maven meta-data from https://maven.google.com/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml.
         > Could not get resource 'https://maven.goo

解決辦法
修改react-native-puti-pay下android目錄的build.gradle文件,指明明確的版本號;
https://bintray.com/wechat-sd...,能夠查看到wechat-sdk的最新版本號,
指定爲最新版本號,就gradle就成功sync了android

//將
  compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
//裏面的加號修改爲微信sdk的最新版本
  compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1'//最新版本
相關文章
相關標籤/搜索