我收到此错误消息:构建:构建失败->运行构建->运行任务->:app:processDebugResources-> executeTaskAction。下面显示的代码顺序为:错误消息,然后是build.gradle(Project),然后是build.gradle(app)。
其他StackOverflow用户之前已经多次回答过此错误消息,但是他们提出的解决方案中没有一个对我有用。主要是因为他们使用的版本建议我修复build.gradle(Project:app)中的“ com.android.support:appcompat-v7:28.0.0”设置,但是它们的版本不同,因为这些帖子来自2+几年前。我试过清理项目,清理构建,重新构建构建和项目,添加“ Maven”存储库,重新安装所有的Sdks……在过去的三个小时中没有任何工作。
这是错误消息:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'. at
org.gradle.api.internal.tasks.execution.ExecuteActionsTask
Executer.executeActions(ExecuteActionsTaskExecuter.java:103) at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.
execute(ExecuteActionsTaskExecuter.java:73) at
org.gradle.api.internal.tasks.execution.OutputDirectoryCreating
TaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at
org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.
execute(SkipUpToDateTaskExecuter.java:59) at
org.gradle.api.internal.tasks.execution.ResolveTaskOutputCaching
StateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at
org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.
execute(ValidatingTaskExecuter.java:59)
at
org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTask
Executer.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at
org.gradle.api.internal.tasks.execution.FinalizeInputFileProperties
TaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.
java:44)
at
org.gradle.api.internal.tasks.execution.CleanupStaleOutputs
Executer.execute(CleanupStaleOutputsExecuter.java:91)
at
org.gradle.api.internal.tasks.execution.ResolveTaskArtifactState
TaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at
org.gradle.api.internal.tasks.execution.SkipTaskWithNoActions
Executer.execute(SkipTaskWithNoActionsExecuter.java:59)
at
org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter
.execute(SkipOnlyIfTaskExecuter.java:54)
at
org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTask
Executer.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at
org.gradle.api.internal.tasks.execution.CatchExceptionTask
Executer.execute(CatchExceptionTaskExecuter.java:34)
at
org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$Event
FiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor$
RunnableBuildOperationWorker.execute(DefaultBuildOperation
Executor.java:336)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor$Runnable
BuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.
execute(DefaultBuildOperationExecutor.java:199)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.
run(DefaultBuildOperationExecutor.java:110)
at
org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$Event
FiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at
org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$Event
FiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$Task
ExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$Task
ExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$Task
ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$Task
ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at
org.gradle.execution.taskgraph.DefaultTaskExecutionPlan
.execute(DefaultTaskExecutionPlan.java:663)
at
org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.
executeWithTask(DefaultTaskExecutionPlan.java:597)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$Task
ExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at
org.gradle.internal.concurrent.ExecutorPolicy$CatchAnd
RecordFailures.onExecute(ExecutorPolicy.java:63)
at
org.gradle.internal.concurrent.ManagedExecutorImpl$1.run
(ManagedExecutorImpl.java:46)
at
java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.
run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$Managed
ThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception:
Android resource linking failed
Output:
/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1
/app/build/generated/not_namespaced_r_class_sources/
debug/processDebugResources/r/com/example/myname
/synthesizer1/R.java: error: invalid symbol name
'com.example.firstname_lastname.synthesizer:id/null'.
Command: /Users/myname/.gradle/caches/transforms-1/files-1.1/aapt2-
3.2.1-4818971-osx.jar/d5f72cb60485350dcf6302aeab61e4d4/aapt2-3.2.1-
4818971-osx/aapt2 link -I\
/Users/myname/Library/Android/sdk/platforms/android-
28/android.jar\
--manifest\
/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1
/app/build/intermediates/merged_manifests/debug/
processDebugManifest/merged/AndroidManifest.xml\
-o\
/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1/app
/build/intermediates/processed_res/debug/processDebugResources
/out/resources-debug.ap_\
-R\
@/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1/
app/build/intermediates/incremental/processDebugResources/resources-
list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1/app
/build/generated/not_namespaced_r_class_sources/debug/processDebug
Resources/r\
--custom-package\
com.example.myname.synthesizer1\
-0\
apk\
--output-text-symbols\
/Users/myname/Downloads/AndroidProjects/MediaLib/Synthesizer1/app/
build/intermediates/symbols/debug/R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
at
com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2
DaemonImpl.kt:177)
at
com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.
kt:103)
at
com.android.builder.internal.aapt.v2.Aapt2DaemonManager$Leased
AaptDaemon.link(Aapt2DaemonManager.kt:176)
at
com.android.builder.core.AndroidBuilder.processResources(Android
Builder.java:823)
at
com.android.build.gradle.internal.res.LinkApplicationAndroid
ResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResources
Task.java:525)
at
com.android.build.gradle.internal.res.LinkApplicationAndroid
ResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask
.java:275)
at
com.android.build.gradle.internal.tasks.IncrementalTask.task
Action(IncrementalTask.java:106)
at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
AccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at
org.gradle.api.internal.project.taskfactory.IncrementalTaskAction
.doExecute(IncrementalTaskAction.java:50)
at
org.gradle.api.internal.project.taskfactory.StandardTaskAction.
execute(StandardTaskAction.java:39)
at
org.gradle.api.internal.project.taskfactory.StandardTaskAction
.execute(StandardTaskAction.java:26)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTask
Executer$1.run(ExecuteActionsTaskExecuter.java:124)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor$Runnable
BuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor$Runnable
BuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.
execute(DefaultBuildOperationExecutor.java:199)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.run
(DefaultBuildOperationExecutor.java:110)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter
.executeAction(ExecuteActionsTaskExecuter.java:113)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter
.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more
这是我的build.gradle(Project)中当前的内容:
//顶层构建文件,您可以在其中添加所有子项目/模块共有的配置选项。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的build.gradle(Module:app);
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.artchen_wei.synthesizer"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-
layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation'com.android.support.test:runner
:1.0.2'
androidTestImplementation'com.android.support.test.
espresso:espresso-core:3.0.2'
}
我正在尝试使构建的所有步骤有效运行,以便我可以完成此任务。
答案 0 :(得分:0)
查看您的错误消息(有点隐藏在大堆栈跟踪中,但是应该 在IDE同步窗口顶部):
错误:无效的符号名称 'com.example.firstname_lastname.synthesizer:id / null'。
这意味着您将在资源中的某个位置定义一个名称为“ null”的ID。它可以位于具有+id/null
构造的任何XML文件中,也可以位于具有<id name="null ... />
或<item type='id' name='null' ... />
的values文件夹中。
在项目中搜索单词null
,您应该可以找到它。由于单词null
是一个非法名称(即您不能在Java中将它用作变量名),因此只需将其重命名为其他名称,例如not_null
。确保不要使用任何其他非法关键字,例如public
,private
,final
,default
等。