首次发布版本时出现appmergeReleaseResource错误

时间:2018-07-23 08:47:47

标签: android android-studio

我使用Firebase数据库,消息和存储创建了一个android应用。该应用在模拟器上运行良好,但创建发布版本会引发错误

  

错误:java.util.concurrent.ExecutionException:   com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:   查看日志以获取详细信息

我在网上搜索了该错误,并找到了一些解决方法。这是我尝试过的几件事

  • 重建和清理项目
  • 使缓存无效并重新启动
  • 迁移项目以应对256个字符的地址限制
  • 检查所有xml文件是否存在任何愚蠢的错误
  • 验证res文件夹中的所有资源和文件名

我现在在这里停留了2-3天,看不到任何解决方案。我的其他项目构建都运行良好,因此我认为这不是与gradle相关的问题。

这是我的build.gradle项目模块

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的build.gradle应用模块

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "infidev.wallpaperhd"
        minSdkVersion 19
        targetSdkVersion 27
        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:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:exifinterface:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.commit451:PhotoView:1.2.4'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.1.0'
}

apply plugin: 'com.google.gms.google-services'

这是“构建”标签中显示的错误消息

com.android.build.gradle.tasks.ResourceException: Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
    at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:296)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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:46)
    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.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.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:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.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$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.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$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
    at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:332)
    at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:301)
    at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:412)
    at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:285)
    ... 48 more
    Suppressed: java.lang.RuntimeException: Some file processing failed, see logs for details
        at com.android.builder.internal.aapt.QueuedResourceProcessor.waitForAll(QueuedResourceProcessor.java:121)
        at com.android.builder.internal.aapt.QueuedResourceProcessor.end(QueuedResourceProcessor.java:141)
        at com.android.builder.internal.aapt.v2.QueueableAapt2.close(QueueableAapt2.java:104)
        at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:293)
        ... 48 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:327)
    ... 51 more
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$compile$0(QueueableAapt2.java:136)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    ... 1 more
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:443)
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:395)
    at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:312)
    at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

任何帮助将不胜感激。

编辑:

这是构建失败后的想法日志

2018-07-23 15:45:40,209 [ thread 36]   INFO - e.project.sync.GradleSyncState - Started setup of project 'WallpapersHD'. 
2018-07-23 15:45:40,209 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: SETUP_STARTED 
2018-07-23 15:45:40,272 [ thread 33]   INFO - idea.project.IndexingSuspender - Indexing suspended (context: Project Setup) 
2018-07-23 15:45:41,381 [e-1024-b02]   INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 27 Platform' (C:\Users\Arun\AppData\Local\Android\Sdk) to module 'app' 
2018-07-23 15:45:42,710 [ thread 36]   INFO - etup.post.PluginVersionUpgrade - Gradle model version: 3.1.3, recommended version for IDE: 3.1.3 
2018-07-23 15:45:42,803 [ thread 36]   INFO - ild.invoker.GradleBuildInvoker - About to execute Gradle tasks: [:app:generateDebugSources] 
2018-07-23 15:45:42,850 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: BUILD_EXECUTOR_CREATED 
2018-07-23 15:45:42,850 [ thread 36]   INFO - e.project.sync.GradleSyncState - Gradle sync finished in 1m 45s 199ms 
2018-07-23 15:45:42,866 [ thread 39]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Android/Android Studio/jre 
2018-07-23 15:45:42,881 [ thread 39]   INFO - ild.invoker.GradleBuildInvoker - Build command line options: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.generateSourcesOnly=true] 
2018-07-23 15:45:42,881 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: BUILD_STARTED 
2018-07-23 15:45:42,881 [ thread 33]   INFO - idea.project.IndexingSuspender - Indexing released (context: Project Setup) 
2018-07-23 15:45:42,897 [ thread 39]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: --configure-on-demand -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.generateSourcesOnly=true 
2018-07-23 15:45:43,038 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender deactivation event: SYNC_FINISHED 
2018-07-23 15:45:43,038 [e-1024-b02]   INFO - idea.project.IndexingSuspender - IndexingSuspender deactivation event received and ignored: SYNC_FINISHED 
2018-07-23 15:45:43,210 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s. 
2018-07-23 15:45:43,210 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Building symbols in FAST mode, 0 source files from total 0 project files 
2018-07-23 15:45:43,210 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Loading Module Maps finished in 0 s. 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Saving Module Maps finished in 0 s. 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Saving Module Maps finished in 0 s. 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Loaded 0 tables for 0 files (0 project files) 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 source files 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 unused headers 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Building symbols finished in 0 s. 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Saving modified symbols for 0 files (0 tables of total 0) 
2018-07-23 15:45:43,225 [ thread 40]   INFO -       #com.jetbrains.cidr.lang - Saving symbols finished in 0 s. 
2018-07-23 15:46:27,578 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender deactivation event: BUILD_FINISHED 
2018-07-23 15:46:27,578 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Finishing batch update for project: Project 'E:\WallpapersHD' WallpapersHD 
2018-07-23 15:46:27,578 [e-1024-b02]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-07-23 15:46:28,068 [e-1024-b02]   INFO - ild.invoker.GradleBuildInvoker - Gradle build finished in 45s 205ms 
2018-07-23 15:46:28,083 [e-1024-b02]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-07-23 15:46:28,693 [e-1024-b02]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-07-23 15:46:29,568 [ thread 40]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 31ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 15:46:29,646 [ thread 40]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 78ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 15:46:29,646 [ thread 40]   INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 52 files to update 
2018-07-23 15:46:30,912 [ thread 40]   INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 1266ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 15:46:30,912 [ thread 40]   INFO - g.FileBasedIndexProjectHandler - Reindexing refreshed files: 1 to update, calculated in 0ms 
2018-07-23 15:46:30,943 [ thread 40]   INFO - .diagnostic.PerformanceWatcher - Reindexing refreshed files took 31ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 15:46:58,921 [e-1024-b02]   INFO - ide.actions.ShowFilePathAction - 'explorer' is not recognized as an internal or external command,
operable program or batch file.

Exit code 1 
2018-07-23 16:02:02,723 [ thread 47]   INFO - ild.invoker.GradleBuildInvoker - About to execute Gradle tasks: [:app:assembleRelease] 
2018-07-23 16:02:02,723 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: BUILD_EXECUTOR_CREATED 
2018-07-23 16:02:02,738 [ thread 47]   INFO - kage.ExportSignedPackageWizard - Export APK command: :app:assembleRelease, destination: -Pandroid.injected.apk.location=E:\WallpapersHD\app 
2018-07-23 16:02:02,754 [ thread 44]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Android/Android Studio/jre 
2018-07-23 16:02:02,754 [ thread 44]   INFO - ild.invoker.GradleBuildInvoker - [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.signing.store.file=C:\Users\Arun\Desktop\current\android\keys\wallpapersHD.jks, -Pandroid.injected.signing.store.password=*********, -Pandroid.injected.signing.key.alias=key0, -Pandroid.injected.signing.key.password=*********, -Pandroid.injected.apk.location=E:\WallpapersHD\app, -Pandroid.injected.signing.v1-enabled=true, -Pandroid.injected.signing.v2-enabled=true] 
2018-07-23 16:02:02,770 [ thread 44]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: --configure-on-demand -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.signing.store.file=C:\Users\Arun\Desktop\current\android\keys\wallpapersHD.jks -Pandroid.injected.signing.store.password=********* -Pandroid.injected.signing.key.alias=key0 -Pandroid.injected.signing.key.password=********* -Pandroid.injected.apk.location=E:\WallpapersHD\app -Pandroid.injected.signing.v1-enabled=true -Pandroid.injected.signing.v2-enabled=true 
2018-07-23 16:02:02,785 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: BUILD_STARTED 
2018-07-23 16:02:02,785 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Starting batch update for project: Project 'E:\WallpapersHD' WallpapersHD 
2018-07-23 16:02:02,973 [ thread 47]   INFO -  #git4idea.commands.GitHandler - [WallpapersHD] git -c core.quotepath=false -c log.showSignature=false rm --ignore-unmatch --cached -- .idea/libraries/Gradle__com_google_firebase_firebase_ads_15_0_1.xml 
2018-07-23 16:02:22,345 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender deactivation event: BUILD_FINISHED 
2018-07-23 16:02:22,345 [e-1024-b02]   INFO - idea.project.IndexingSuspender - Finishing batch update for project: Project 'E:\WallpapersHD' WallpapersHD 
2018-07-23 16:02:22,408 [e-1024-b02]   INFO - ild.invoker.GradleBuildInvoker - Gradle build finished in 19s 665ms 
2018-07-23 16:02:22,439 [e-1024-b02]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-07-23 16:02:22,830 [e-1024-b02]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-07-23 16:02:23,111 [ thread 47]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 16ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 16:02:23,189 [ thread 47]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 78ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 16:02:23,189 [ thread 47]   INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 8 files to update 
2018-07-23 16:02:23,283 [ thread 47]   INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 94ms; general responsiveness: ok; EDT responsiveness: ok 
2018-07-23 16:02:47,515 [e-1024-b02]   INFO - ide.actions.ShowFilePathAction - 'explorer' is not recognized as an internal or external command,
operable program or batch file.

Exit code 1 

0 个答案:

没有答案