And*_*cks 5 android docker circleci gradlew kapt
我在 Android 项目代码库的 CircleCI 2.0 配置中有以下内容。
version: 2
jobs:
build:
environment:
TERM: dumb
JVM_OPTS: -Xmx4g -Xms2g -XX:MaxPermSize=2g
# ###### Use these for other Docker Images, if need be ##########
# ANDROID_SDK_ROOT: /usr/local/android-sdk-linux
# SDK_MANAGER: $ANDROID_SDK_ROOT/tools/bin/sdkmanager
GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
ANDROID_COMPILE_VERSION: 27
ANDROID_TARGET_VERSION: 27
ANDROID_MIN_VERSION: 21
ANDROID_BUILD_VERSION: 28.0.2
ANDROID_SUPPORT_VERSION: 27.1.1
KOTLIN_VERSION: 1.2.70
working_directory: ~/workSpace
branches:
only:
- develop
- release/<*>
- feature/circle_ci_cd
ignore:
- bugfix/<*>
- refactor/<*>
docker:
- image: circleci/android:api-$ANDROID_TARGET_VERSION-alpha
# java:
# version: oraclejdk8
# ####### Other Docker Images, if need be ############
# dependencies:
# pre:
# - $SDK_MANAGER --install "tools" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "platforms;android-$ANDROID_TARGET_VERSION" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "build-tools;$ANDROID_BUILD_VERSION" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "platform-tools" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "extras;android;m2repository" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "extras;google;m2repository" && yes | $SDK_MANAGER --licenses
# - $SDK_MANAGER --install "extras;google;google_play_services" && yes | $SDK_MANAGER --licenses
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule init
git submodule sync
git submodule update --remote
- run:
name: "Android SDK Properties"
command: |
sed -i "s/compileSdkVersion=*.*/compileSdkVersion=$ANDROID_COMPILE_VERSION/" gradle.properties
sed -i "s/targetSdkVersion=*.*/targetSdkVersion=$ANDROID_TARGET_VERSION/" gradle.properties
sed -i "s/minSdkVersion=*.*/minSdkVersion=$ANDROID_MIN_VERSION/" gradle.properties
sed -i "s/buildToolsVersion=*.*/buildToolsVersion=$ANDROID_BUILD_VERSION/" gradle.properties
sed -i "s/supportVersion=*.*/supportVersion=$ANDROID_SUPPORT_VERSION/" gradle.properties
sed -i "s/kotlinVersion=*.*/kotlinVersion=$KOTLIN_VERSION/" gradle.properties
sed -i "s/versionCode=*.*/versionCode=${CIRCLE_BUILD_NUM:-1}/" gradle.properties
# ######## Other Docker Images, if need be ###########
# - run:
# name: "Update Android"
# command: $SDK_MANAGER --update && yes | $SDK_MANAGER --licenses
- run:
name: "Clean local.properties"
command: rm -rf local.properties || true
- run:
name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
command: chmod +x ./gradlew
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Assemble
command: ./gradlew clean assemble
- save_cache:
paths:
- ${CIRCLE_WORKING_DIRECTORY}/.gradle
- ${ANDROID_SDK_ROOT}
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
# - store_artifacts:
# path: app/build/reports
# destination: reports
# - store_test_results:
# path: app/build/test-results
# See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples
Run Code Online (Sandbox Code Playgroud)
gradle.properties 文件中的其他属性很少
org.gradle.jvmargs=-Xms2g -Xmx4g -XX:MaxPermSize=2g -XX:+HeapDumpOnOutOfMemoryError -XX:ReservedCodeCacheSize=2g -Dfile.encoding=UTF-8
org.gradle.configureondemand=false
org.gradle.caching=true
org.gradle.daemon=false
org.gradle.parallel=false
kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process
android.enableBuildCache=true
android.enableR8=true
Run Code Online (Sandbox Code Playgroud)
Gradle 包装器版本如下。
https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Run Code Online (Sandbox Code Playgroud)
Gradle Android 插件。
'com.android.tools.build:gradle:3.3.0-alpha10'
Run Code Online (Sandbox Code Playgroud)
以下是构建变体配置。
flavorDimensions "product", "store"
productFlavors {
free { dimension "product" }
paid { dimension "product" }
google { dimension "store" }
amazon { dimension "store" }
}
Run Code Online (Sandbox Code Playgroud)
开发机为 MacOS High Sierra:10.13.6,3.5 GHz Intel Core i5 CPU,32 GB 2400 MHz DDR4 RAM。
这就是正在发生的事情。
构建变体的顺序是按时间顺序排列的,根据给定的风味维度,因此以下八个是由 gradle 按确切顺序创建的。
这些构建变体中的每一个都有一个任务依赖列表。基于任务依赖性,这就是正在发生的事情。
使用 Kotlin 编译守护进程编译不成功 java.rmi.UnmarshalException: Error unmarshaling return header; 嵌套异常是: java.io.EOFException at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:236) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161) at java.rmi.server。 RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179) at com.sun.proxy.$Proxy106.compile(Unknown Source) at org.jetbrains.kotlin.compile .GradleCompilerRunner.nonIncrementalCompilationWithDaemon(GradleKotlinCompilerRunner.kt:256) 在 org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner。concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java: 55) 在 java.lang.Thread.run(Thread.java:748) 引起:java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall (StreamRemoteCall.java:222) ... 65 编译后无法清除 jar 缓存,可能守护进程已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)在 java.lang.Thread.run(Thread.java:748) 引起: java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall) .java:222) ... 65 编译后无法清除 jar 缓存,可能守护程序已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)在 java.lang.Thread.run(Thread.java:748) 引起: java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall) .java:222) ... 65 编译后无法清除 jar 缓存,可能守护程序已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java .lang.Thread.run(Thread.java:748) 引起: java.io.DataInputStream.readByte(DataInputStream.java:267) 处的 java.io.EOFException at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java) :222) ... 65 编译后无法清除 jar 缓存,可能守护进程已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java .lang.Thread.run(Thread.java:748) 引起: java.io.DataInputStream.readByte(DataInputStream.java:267) 处的 java.io.EOFException at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java) :222) ... 65 编译后无法清除 jar 缓存,可能守护进程已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在 java.lang.Thread.run(Thread.java:748)引起:java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 more Unable to clear jar cache编译后,也许守护进程已经关闭: java.rmi.ConnectException: Connection denied to host: 127.0.0.1; 嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在 java.lang.Thread.run(Thread.java:748)引起: java.io.DataInputStream.readByte(DataInputStream.java:267) 处的 java.io.EOFException at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 更多 无法清除 jar 缓存编译后,也许守护进程已经关闭: java.rmi.ConnectException: Connection denied to host: 127.0.0.1; 嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。由 java.io.DataInputStream.readByte(DataInputStream.java: 267) 在 sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 更多 编译后无法清除 jar 缓存,可能守护程序已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0 .0.1; 嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。由 java.io.DataInputStream.readByte(DataInputStream.java: 267) 在 sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 更多 编译后无法清除 jar 缓存,可能守护程序已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0 .0.1; 嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 more 编译后无法清除 jar 缓存,可能守护进程已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。readByte(DataInputStream.java:267) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222) ... 65 more 编译后无法清除 jar 缓存,可能守护进程已经关闭:java.rmi.ConnectException:连接拒绝主机:127.0.0.1;嵌套异常是:java.net.ConnectException:连接被拒绝(连接被拒绝)无法连接到 kotlin 守护进程。使用回退策略。
我已经尝试了所有我能想到的 gradle 选项和 java 选项和 docker 选项的可能组合,我可以尝试在 Internet 上找到,但没有任何帮助。
这些故障仅发生在云上的 CircleCI 2.0 或使用给定 Docker 映像的 CircleCI CLI 中。本地的 gradle 构建是稳定的。
任何指向解决方案的指针将不胜感激。
android {
kapt {
useBuildCache true
}
dexOptions {
preDexLibraries true
jumboMode false
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1162 次 |
| 最近记录: |