当我尝试使用jenkins构建我的android项目时,构建总是失败。但是当我通过android studio进行构建时,它会成功。
我的项目级别build.gradle代码在下面给出
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.novoda:bintray-release:0.5.0'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
maven {
url "http://dl.bintray.com/schibstedspain/maven"
}
maven {
url 'https://esri.bintray.com/arcgis'
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
模块级别build.gradle在下面给出
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example.demoapp"
versionName "1.0.0.6"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
}
flavorDimensions "demoapp"
productFlavors {
localdev {
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_local_dev"
]
}
dev {
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_dev"
]
}
}
buildTypes {
release {
debuggable false
minifyEnabled false
shrinkResources false
jniDebuggable false
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Android Support libraries
def supportVersion = '28.0.0'
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:support-vector-drawable:$supportVersion"
implementation "com.android.support:mediarouter-v7:$supportVersion"
// ArcGIS
def arcGISVersion = '100.3.0'
implementation "com.esri.arcgisruntime:arcgis-android:$arcGISVersion"
// Square libraries
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp3:okhttp:3.3.1'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
implementation 'com.squareup.retrofit2:converter-jackson:2.0.0'
implementation 'io.reactivex:rxandroid:1.2.1'
// Google lilbraries
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.google.android.gms:play-services:11.6.0'
implementation 'com.google.android.gms:play-services-base:11.6.0'
// Fabric
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
transitive = true
}
implementation 'commons-io:commons-io:2.0.1'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
testImplementation 'junit:junit:4.12'
//Circular imageView hdodenhof
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
以下是我得到的日志。
失败:构建失败,并出现异常。
出了什么问题: 任务':app:mergeDevDebugResources'的执行失败。
java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:Android资源编译失败 输出:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light。 :找不到文件。
命令:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ aapt2-3.2.1-4818971-windows.jar \ d0f8b1c9646d3205e347ca7495d045a1 \ aapt2-3.2.1-4818971- Windows \ aapt2.exe编译--no-crunch \ -旧版\ -o \ D:\ workspace \ technical \ app \ build \ intermediates \ res \ merged \ dev \ debug \ C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light.png 守护进程:AAPT2 aapt2-3.2.1-4818971-windows守护进程#0
尝试: 使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
例外是: org.gradle.api.tasks.TaskExecutionException:任务':app:mergeDevDebugResources'的执行失败。 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) 在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)处 在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) 在org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:66) 在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) 在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)处 在org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) 在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) 在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)处 在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) 在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:256) 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)处 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)处 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)处 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200(DefaultTaskPlanExecutor.java:79) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:104) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:98) 在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)处 在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) 在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 在org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46) 在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 引起原因:org.gradle.internal.UncheckedException:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:Android资源编译失败 输出:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light。 :找不到文件。
命令:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ aapt2-3.2.1-4818971-windows.jar \ d0f8b1c9646d3205e347ca7495d045a1 \ aapt2-3.2.1-4818971- Windows \ aapt2.exe编译--no-crunch \ -旧版\ -o \ D:\ workspace \ technical \ app \ build \ intermediates \ res \ merged \ dev \ debug \ C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light.png 守护程序:AAPT2 aapt2-3.2.1-4818971-windows守护程序#0 在org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63) 在org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76) 在org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:124) 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)处 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) ...另外31个 引起原因:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:Android资源编译失败 输出:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light。 :找不到文件。
命令:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ aapt2-3.2.1-4818971-windows.jar \ d0f8b1c9646d3205e347ca7495d045a1 \ aapt2-3.2.1-4818971- Windows \ aapt2.exe编译--no-crunch \ -旧版\ -o \ D:\ workspace \ technical \ app \ build \ intermediates \ res \ merged \ dev \ debug \ C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light.png 守护程序:AAPT2 aapt2-3.2.1-4818971-windows守护程序#0 在com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:56) 在com.android.build.gradle.internal.aapt.WorkerExecutorResourceCompilationService.close(WorkerExecutorResourceCompilationService.kt:67) 在com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:324) 在com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) ...另外41个 引起原因:com.android.builder.internal.aapt.v2.Aapt2Exception:Android资源编译失败 输出:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light。 :找不到文件。
命令:C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ aapt2-3.2.1-4818971-windows.jar \ d0f8b1c9646d3205e347ca7495d045a1 \ aapt2-3.2.1-4818971- Windows \ aapt2.exe编译--no-crunch \ -旧版\ -o \ D:\ workspace \ technical \ app \ build \ intermediates \ res \ merged \ dev \ debug \ C:\ Windows \ System32 \ config \ systemprofile.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-27.1.1.aar \ 38d0f08e978f9054bdf191f5dc7a9836 \ res \ drawable-xhdpi-v4 \ abc_text_select_handle_middle_mtrl_light.png 守护程序:AAPT2 aapt2-3.2.1-4818971-windows守护程序#0 在com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doCompile(Aapt2DaemonImpl.kt:142) 在com.android.builder.internal.aapt.v2.Aapt2Daemon.compile(Aapt2Daemon.kt:81) 在com.android.builder.internal.aapt.v2.Aapt2DaemonManager $ LeasedAaptDaemon.compile(Aapt2DaemonManager.kt:170) 在com.android.build.gradle.internal.res.Aapt2CompileWithBlameRunnable $ run $ 1.invoke(Aapt2CompileWithBlameRunnable.kt:37) 在com.android.build.gradle.internal.res.Aapt2CompileWithBlameRunnable $ run $ 1.invoke(Aapt2CompileWithBlameRunnable.kt:28) 在com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon(Aapt2DaemonManagerService.kt:71) 在com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon $ default(Aapt2DaemonManagerService.kt:69) 在com.android.build.gradle.internal.res.Aapt2CompileWithBlameRunnable.run(Aapt2CompileWithBlameRunnable.kt:34) 在com.android.ide.common.workers.ExecutorServiceAdapter $ submit $ submission $ 1.run(ExecutorServiceAdapter.kt:39)
18秒内失败 18个可执行任务:已执行16个,其中2个是最新的
由于配置问题,未发布构建扫描。
未同意Gradle服务条款。
要同意Gradle服务条款,请在根项目的配置中包括以下内容: buildScan {termsOfServiceUrl ='https://gradle.com/terms-of-service'; termsOfServiceAgree ='是'}
有关更多信息,请参见https://gradle.com/scans/help/plugin-terms-of-service。
或者,如果您正在使用Gradle Enterprise,请指定服务器位置。 有关更多信息,请参见https://gradle.com/scans/help/plugin-enterprise-config。
构建步骤“ Invoke Gradle脚本”将构建结果更改为FAILURE 构建步骤“ Invoke Gradle脚本”将构建标记为失败 完成:失败
答案 0 :(得分:0)
使用jenkins构建文件时似乎找不到某些文件。这可能是由于运行Jenkins服务的用户所致。您可以按照以下步骤尝试更改jenkins服务的用户: