处理资源失败,详情见下面的 aapt 输出

Posted

技术标签:

【中文标题】处理资源失败,详情见下面的 aapt 输出【英文标题】:Failed to process resources, see aapt output below for details 【发布时间】:2019-02-28 21:48:55 【问题描述】:

我正在尝试为我的应用生成我的 apk,我运行了以下命令:

 ./gradlew assembleRelease --stacktrace --debug

我得到了上面的错误..在stackTrace之后我得到了这个:

12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processReleaseResources'.
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
12:19:05.410 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
12:19:05.411 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.tooling.BuildException: Failed to process resources, see aapt output above for details.
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:512)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.java:249)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
12:19:05.412 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 31 more
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:491)
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 45 more
12:19:05.413 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process /Users/talshani/Library/Developer/Xamarin/android-sdk-macosx/build-tools/28.0.2/aapt with arguments package -f --no-crunch -I /Users/talshani/Library/Developer/Xamarin/android-sdk-macosx/platforms/android-28/android.jar -M /Users/talshani/app/mobile_app/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /Users/talshani/app/mobile_app/android/app/build/intermediates/res/merged/release -m -J /Users/talshani/app/mobile_app/android/app/build/generated/source/r/release -F /Users/talshani/app/mobile_app/android/app/build/intermediates/res/release/resources-release.ap_ -D /Users/talshani/app/mobile_app/android/app/build/intermediates/multi-dex/release/manifest_keep.txt --custom-package com.vitalacy.dashboard -0 apk --output-text-symbols /Users/talshani/app/mobile_app/android/app/build/intermediates/symbols/release --no-version-vectors
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 47 more
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: com.android.ide.common.process.ProcessException: Error while executing process /Users/talshani/Library/Developer/Xamarin/android-sdk-macosx/build-tools/28.0.2/aapt with arguments package -f --no-crunch -I /Users/talshani/Library/Developer/Xamarin/android-sdk-macosx/platforms/android-28/android.jar -M /Users/talshani/app/mobile_app/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /Users/talshani/app/mobile_app/android/app/build/intermediates/res/merged/release -m -J /Users/talshani/app/mobile_app/android/app/build/generated/source/r/release -F /Users/talshani/app/mobile_app/android/app/build/intermediates/res/release/resources-release.ap_ -D /Users/talshani/app/mobile_app/android/app/build/intermediates/multi-dex/release/manifest_keep.txt --custom-package com.vitalacy.dashboard -0 apk --output-text-symbols /Users/talshani/app/mobile_app/android/app/build/intermediates/symbols/release --no-version-vectors
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1237)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)
12:19:05.414 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58)
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.process.internal.ExecException: Process 'command '/Users/talshani/Library/Developer/Xamarin/android-sdk-macosx/build-tools/28.0.2/aapt'' finished with non-zero exit value 1
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:395)
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)
12:19:05.415 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 9 more

这是我的 app/build.gradle 文件:

  apply plugin: "com.android.application"

 buildscript 
 repositories 
 maven  url 'https://maven.fabric.io/public' 
  
 dependencies 
 // The Fabric Gradle plugin uses an open ended version to react
 // quickly to Android tooling updates
 classpath 'io.fabric.tools:gradle:1.+'
   
  
   apply plugin: 'io.fabric'
     repositories 
   maven  url 'https://maven.fabric.io/public' 
    
  import com.android.build.OutputFile


    project.ext.react = [
     entryFile: "index.js"
      ]

    apply from: "../../node_modules/react-native/react.gradle"
    def enableSeparateBuildPerCPUArchitecture = false
    def enableProguardInReleaseBuilds = false

   android 
   compileSdkVersion 28
   buildToolsVersion "28.0.2"
    dexOptions 
        javaMaxHeapSize "4g"
     
    defaultConfig 
     applicationId "com.vitalacy.dashboard"
     minSdkVersion 16
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    ndk 
        abiFilters "armeabi-v7a", "x86"
       
    
    signingConfigs 
       release 
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) 
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
                
               
              
      splits 
          abi 
         reset()
         enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
         
        
     buildTypes 
        release 
          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
        
   
// applicationVariants are e.g. debug, release
applicationVariants.all  variant ->
    variant.outputs.each  output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null)   // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        
    

 dependencies 
  compile project(':react-native-fabric')
  compile project(':react-native-vector-icons')
  compile project(':react-native-spinkit')
  compile project(':react-native-push-notification')
  compile project(':react-native-picker')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-image-crop-picker')
  compile project(':react-native-firebase')
  compile project(':react-native-fcm')
  compile project(':react-native-device-info')
  compile project(':react-native-config')
  implementation project(':react-native-picker')
  implementation project(':react-native-device-info')
  implementation project(':react-native-fcm')
  implementation project(':react-native-firebase')
  implementation project(':react-native-svg')
  implementation project(':react-native-vector-icons')
  implementation project(':react-native-spinkit')
  implementation project(':react-native-push-notification')
  implementation project(':react-native-linear-gradient')
  implementation project(':react-native-image-crop-picker')
  implementation project(':react-native-config')
  implementation fileTree(dir: "libs", include: ["*.jar"])
  implementation "com.google.android.gms:play-services-gcm:15.0.1"
  implementation "com.android.support:appcompat-v7:28.0.0-rc02"
  implementation "com.facebook.react:react-native:+"  // From node_modules
  implementation 'com.google.firebase:firebase-core:16.0.1'
  implementation 'com.google.firebase:firebase-messaging:17.0.0' //17.3.1
  implementation 'com.android.support:multidex:1.0.3'
   compile('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') 
     transitive = true;
    

   

task copyDownloadableDepsToLibs(type: Copy) 
from configurations.compile
into 'libs'
 
 apply plugin: 'com.google.gms.google-services'
 com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

这是我的 android/build.gradle:

      buildscript 
     repositories 
       google()
       jcenter()
     
   dependencies 
    classpath 'com.android.tools.build:gradle:3.2.0-alpha11'
    classpath 'com.google.gms:google-services:4.1.0'
        
       


     allprojects 
      repositories 
            maven  url "https://jitpack.io" 
          mavenLocal()
          google()
          jcenter()

        maven 
        url "$rootDir/../node_modules/react-native/android"
                 

           
        

  ext 
   compileSdkVersion = 28
   targetSdkVersion = 28
   buildToolsVersion = "28.0.2"
   supportLibVersion = "28.0.0-rc02"
   googlePlayServicesVersion = "15.0.1"
   oreoEXPERIMENTAL = "yes"
         

  subprojects 
    afterEvaluate project ->
      if (project.hasProperty("android")) 
        android 
            compileSdkVersion 28
            buildToolsVersion '28.0.2'
           
         
      
   

我已经尝试了好几个小时来解决这个问题,但现在没有任何帮助, 当我在做我的调试应用程序时没有问题。

-在 res 文件夹中我有这些文件夹:drawable-hdpi-v4,drawable-mdpi-v4,drawable-xhdpi-v4,drawable-xxhdpi-v4,drawable-xxxhdpi-v4,mipmap-hdpi,mipmap-mdpi ,mipmap-xhdpi,mipmap-xxhdpi,mipmap-xxxhdpi,values... 我不认为我在使用 drawable 但我知道我在使用 mipmap。

非常感谢您的帮助!

解决方案:

不确定这是正确的解决方案,但它帮助我继续前进,它是删除所有带有可绘制对象的文件夹。顺便说一句,--debug 只是让我感到困惑,并没有帮助我清楚地看到错误(--stacktrace 就足够了)

【问题讨论】:

【参考方案1】:

请在 android/build.gradle 文件中更改 com.android.tools.build:gradle 版本。

类路径'com.android.tools.build:gradle:3.2.0-alpha11'

同时检查你的 res 文件夹,应该没有任何损坏的文件。

【讨论】:

您的意思是将我的构建 gradle 更改为您告诉我的那个吗?为什么会有所不同? 是的。您必须使用提到的版本进行更改。这个版本有这个修复。 在 res 文件夹中我有这些文件夹:drawable-hdpi-v4,drawable-mdpi-v4,drawable-xhdpi-v4,drawable-xxhdpi-v4,drawable-xxxhdpi-v4,mipmap- hdpi,mipmap-mdpi,mipmap-xhdpi,mipmap-xxhdpi,mipmap-xxxhdpi,values... 我不认为我使用可绘制但我知道我使用 mipmap。我该怎么办? 首先通过更改版本进行检查。如果一切正常,则无需检查 res 文件夹。 改版后同样的问题

以上是关于处理资源失败,详情见下面的 aapt 输出的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio Android 资源链接失败错误.. AAPT:错误:找不到资源 android:attr/lStar。在 values.xml 105

运行应用程序使用 Kotlin 构建失败 AAPT:错误:找不到资源 android:attr/lStar

任务“:app:processDebugResources”的颤振执行失败。 AAPT:错误:找不到资源字符串/app_name

生成签名时出现错误 AAPT Android Studio

Android--aapt命令

我无法通过“Android 资源链接失败”错误