当前位置: 首页 > 工具软件 > wechat-sdk > 使用案例 >

Unity打包失败的Bug:Could not resolve com.tencent.mm.opensdk:wechat-sdk-android:+.

湛嘉歆
2023-12-01

版本:Unity2018.4.25f1。 

过个周末,周一的时候项目突然打包失败,显示无法从“https://jcenter.bintray.com/”获取微信的依赖包。

CommandInvokationFailure: Gradle build failed. 
D:\Program Files\Unity2018.4.25f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "D:\Program Files\Unity2018.4.25f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkDebugClasspath'.
> Could not resolve all files for configuration ':debugCompileClasspath'.
   > Could not resolve com.tencent.mm.opensdk:wechat-sdk-android:+.
     Required by:
         project :
      > Failed to list versions for com.tencent.mm.opensdk:wechat-sdk-android.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/tencent/mm/opensdk/wechat-sdk-android/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/tencent/mm/opensdk/wechat-sdk-android/maven-metadata.xml'.
               > Read timed out

根据无法获取'https://jcenter.bintray.com/com/网站的资源_guanguanboy的博客-CSDN博客

的操作。

更换jcenter的引用

原文:

allprojects {
    repositories {
            maven {
                url "https://mirrors.tencent.com/nexus/repository/maven-public/"
            }
            maven {
                url "https://mirrors.tencent.com/repository/maven/tencent_public/"
            }
            google()
            jcenter()
            mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}

修改后: 

allprojects {
    repositories {
            maven {
                url "https://mirrors.tencent.com/nexus/repository/maven-public/"
            }
            maven {
                url "https://mirrors.tencent.com/repository/maven/tencent_public/"
            }
            google()
            jcenter { url 'https://maven.aliyun.com/repository/public' }
            mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}

打包成功。

 类似资料: