gradle打包错误记录

1

<pre style="white-space: pre-wrap; overflow-wrap: break-word; margin: 0px; color: rgb(0, 0, 0); font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">20:04:03:254 [gradle]* What went wrong:

20:04:03:254 [gradle]A problem occurred configuring project ':aarSubAsset'.

20:04:03:254 [gradle]> 
20:04:03:254 [gradle]Could not resolve all files for configuration ':aarSubAsset:classpath'.

20:04:03:254 [gradle]   
20:04:03:254 [gradle]> 
20:04:03:255 [gradle]Could not download kotlin-stdlib-jdk7-1.8.20-RC2.jar (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20-RC2)

20:04:03:255 [gradle]      > 
20:04:03:255 [gradle]Could not get resource '[https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.20-RC2/kotlin-stdlib-jdk7-1.8.20-RC2.jar](https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.20-RC2/kotlin-stdlib-jdk7-1.8.20-RC2.jar)'.

20:04:03:255 [gradle]         
20:04:03:255 [gradle]> 
20:04:03:256 [gradle]Could not GET '[https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.20-RC2/kotlin-stdlib-jdk7-1.8.20-RC2.jar](https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.20-RC2/kotlin-stdlib-jdk7-1.8.20-RC2.jar)'.
            > 
20:04:03:256 [gradle]Read timed out</pre>

构建机首次打包时报这个错,看起来像网络问题,看了梯子是正常的,远程到构建机打开powershell手动gradlew assembRelease,结果好了~

2

* What went wrong:
A problem occurred configuring project ':aarSubAsset'.
> Could not resolve all files for configuration ':aarSubAsset:classpath'.
   > Could not resolve com.android.tools.build:gradle:8.1.1.
     Required by:
         project :aarSubAsset
      > Could not resolve com.android.tools.build:gradle:8.1.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/8.1.1/gradle-8.1.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/8.1.1/gradle-8.1.1.pom'.
               > Read timed out
   > Could not resolve com.google.gms:google-services:4.3.13.
     Required by:
         project :aarSubAsset
      > Could not resolve com.google.gms:google-services:4.3.13.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.13/google-services-4.3.13.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.13/google-services-4.3.13.pom'.
               > Read timed out
   > Could not resolve com.google.firebase:perf-plugin:1.4.1.
     Required by:
         project :aarSubAsset
      > Could not resolve com.google.firebase:perf-plugin:1.4.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/perf-plugin/1.4.1/perf-plugin-1.4.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/perf-plugin/1.4.1/perf-plugin-1.4.1.pom'.
               > Read timed out
   > Could not resolve com.google.firebase:firebase-crashlytics-gradle:2.9.2.
     Required by:
         project :aarSubAsset
      > Could not resolve com.google.firebase:firebase-crashlytics-gradle:2.9.2.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-crashlytics-gradle/2.9.2/firebase-crashlytics-gradle-2.9.2.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-crashlytics-gradle/2.9.2/firebase-crashlytics-gradle-2.9.2.pom'.
               > Read timed out
   > Could not resolve com.huawei.agconnect:agcp:1.9.1.300.
     Required by:
         project :aarSubAsset
      > Could not resolve com.huawei.agconnect:agcp:1.9.1.300.
         > Could not get resource 'https://developer.huawei.com/repo/com/huawei/agconnect/agcp/1.9.1.300/agcp-1.9.1.300.pom'.
            > Could not GET 'https://developer.huawei.com/repo/com/huawei/agconnect/agcp/1.9.1.300/agcp-1.9.1.300.pom'.
               > Read timed out

* 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.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 55s

依然是依赖下载失败问题,这次不管是用android studio还是直接在power shell下都失败。
确认了代理没问题,ping各个仓库也都没问题。更换使用aliyun的镜像也都无济于事,最后发现C:\Users\clientbuilder\.gradle\gradle.properties

## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
#Wed Oct 15 19:45:37 CST 2025
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=10809
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=10809
systemProp.socks.proxyHost=127.0.0.1
systemProp.socks.proxyPort=10808
systemProp.socks5.proxyHost=127.0.0.1
systemProp.socks5.proxyPort=10808

很奇怪的是这里的代理设置其实没问题,但把它去掉就好了,wtf...

3

* What went wrong:
A problem occurred configuring project ':aarSubAsset'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\clientbuilder\.gradle\caches\jars-9\1d30e719710e5fe80b0e7bb746da42e3\google-services-4.3.13.jar.

* 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.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 26s

不是写入权限的问题,执行以下命令解决:.\gradlew --stop

4

ld.lld: error: undefined symbol: InitialPuerts
20:38:12:114 [gradle]
>>> referenced by com.tencent.puerts.core.cpp:14493 (F:/games/dp2_android_publish/export/unityLibrary/src/main/Il2CppOutputProject/Source/il2cppOutput/com.tencent.puerts.core.cpp:14493)
>>>               iz17/91q2xuuhn1hm.o:(JsEnv__ctor_m721E14524F762EED47C03E0096E54C27589FA674)
>>> referenced by com.tencent.puerts.core.cpp:14493 (F:/games/dp2_android_publish/export/unityLibrary/src/main/Il2CppOutputProject/Source/il2cppOutput/com.tencent.puerts.core.cpp:14493)
>>>               iz17/91q2xuuhn1hm.o:(NativeAPI_InitialPuerts_mFDC8055FE154E362AA3C76915AE06951E115E3D5)

这是和puerts相关的报错,这次升级puerts版本到v2.2.2,根据官方文档:https://puerts.github.io/docs/puerts/unity/performance/il2cpp#%25%E4%BD%BF%E7%94%A8%E6%AD%A5%E9%AA%A4

image.png

由于我暂时不需要这个功能,可以先添加PUERTS_DISABLE_IL2CPP_OPTIMIZATION将其关闭。或者生成对应的c++产物也可。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容