React Native构建失败任务:app:processReleaseResources失败执行aapt

时间:2019-10-15 08:07:30

标签: android react-native gradle

我使用assembleRelease准备发布内部版本,但出现此错误。

  
    

配置项目:app已弃用项目':app'中的配置'compile'。改用“实现”。

         

配置项目:rn-fetch-blob CompileOptions.bootClasspath属性已被弃用,并计划在Gradle中删除     5.0。请改用CompileOptions.bootstrapClasspath属性。

         

配置项目:react-native-onesignal已弃用项目':react-native-onesignal'中的配置'compile'。采用     而是“实施”。在项目中配置“ testCompile”     ':react-native-onesignal'已弃用。使用“ testImplementation”     代替。

         

配置项目:react-native-image-crop-picker已弃用项目':react-native-image-crop-picker'中的配置'compile'。     改用“实现”。

         

任务:app:bundleReleaseJsAndAssets警告:转换缓存已重置。加载依赖图,完成。 bundle:编写bundle输出     至:     /Users/appfile/android/app/build/generated/assets/react/release/index.android.bundle     捆绑软件:完成捆绑软件的输出捆绑软件:复制43个资产文件     捆绑:完成复制资产

  
     

/Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml:70:23-42:   AAPT:找不到与给定名称匹配的资源(在“ icon”中带有   值'@ mipmap / ic_launcher')。        /Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml:72:24-39:   AAPT:找不到与给定名称匹配的资源(在“主题”中带有   值'@ style / AppTheme')。        警告:字符串'ucrop_error_input_data_is_absent'没有默认翻译。警告:字符串'ucrop_mutate_exception_hint'没有   默认翻译。   /Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml:67:   错误:错误:找不到与给定名称匹配的资源(在“图标”处   值为'@ mipmap / ic_launcher')。

     

/Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml:67:   错误:错误:找不到与给定名称匹配的资源(位于   值“ @ style / AppTheme”的“主题”。

     
    

任务:app:processReleaseResources失败执行aapt com.android.ide.common.process.ProcessException失败:无法执行     Aapt             在com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)             在com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)             在com.android.build.gradle.tasks.ProcessAndroidResources.doFullTask​​Action(ProcessAndroidResources.java:285)             在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:109)             在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处             在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)             在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)             在java.lang.reflect.Method.invoke(Method.java:498)             在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)             在org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:46)             在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:121)             在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:110)处             在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)             在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)             在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)处             在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)             在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)             在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)             在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)             在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)             在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)处             在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)             在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:248)             在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:241)处             在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)处             在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:626)处             在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)处             在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)             在java.util.concurrent.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.util.concurrent.ExecutionException:     com.android.ide.common.process.ProcessException:执行时出错     进程/Users/zasetsu/Library/Android/sdk/build-tools/27.0.3/aapt     带有参数{package -f --no-crunch -I     /Users/zasetsu/Library/Android/sdk/platforms/android-27/android.jar -M     /Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml     -S / Users / appfile / android / app / build / intermediates / res / merged / release -m -J / Users / appfile / android / app / build / generation / source / r / release -F / Users / appfile / android /app/build/intermediates/res/release/resources-release.ap_     --custom-package com.gnpush.istapp -0 apk --output-text-symbols / Users / appfile / android / app / build / intermediates / symbols / release     --no-version-vectors}             在com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)             在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)             在com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79)             在com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)             ... 50更多原因:com.android.ide.common.process.ProcessException:执行时出错     进程/Users/zasetsu/Library/Android/sdk/build-tools/27.0.3/aapt     带有参数{package -f --no-crunch -I     /Users/zasetsu/Library/Android/sdk/platforms/android-27/android.jar -M     /Users/appfile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml     -S / Users / appfile / android / app / build / intermediates / res / merged / release -m -J / Users / appfile / android / app / build / generation / source / r / release -F / Users / appfile / android /app/build/intermediates/res/release/resources-release.ap_     --custom-package com.gnpush.istapp -0 apk --output-text-symbols / Users / appfile / android / app / build / intermediates / symbols / release     --no-version-vectors}             在com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73)             在com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48)             在com.android.builder.internal.aapt.AbstractProcessExecutionAapt $ 1.onSuccess(AbstractProcessExecutionAapt.java:78)             在com.android.builder.internal.aapt.AbstractProcessExecutionAapt $ 1.onSuccess(AbstractProcessExecutionAapt.java:74)             在com.google.common.util.concurrent.Futures $ CallbackListener.run(Futures.java:1237)             com.google.common.util.concurrent.MoreExecutors $ DirectExecutor.execute(MoreExecutors.java:399)             在com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911)             在com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)             在com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)             在com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)             在com.android.build.gradle.internal.process.GradleProcessExecutor $ 1.run(GradleProcessExecutor.java:58)     引起原因:org.gradle.process.internal.ExecException:流程'命令     '/Users/zasetsu/Library/Android/sdk/build-tools/27.0.3/aapt''完成     非零退出值1             在org.gradle.process.internal.DefaultExecHandle $ ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382)             在com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)             ...还有9个

  
     

失败:构建失败,并出现异常。

     
      
  • 出了什么问题:任务':app:processReleaseResources'的执行失败。      
        

    无法执行aapt

      
  •   

我的build.gradle文件;

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 27
        supportLibVersion = "27.1.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }


      // ADD THIS
      maven { url 'https://maven.google.com' }

      // ADD THIS
      maven { url "https://jitpack.io" }
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}


configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}

1 个答案:

答案 0 :(得分:0)

您检查资产了吗? 将显示一条错误消息,提示缺少图标ic_launcheric_launcher是Android上的图标应用 检查您的Android应用中mipmap的{​​{1}}文件夹中是否包含res个文件,如以下屏幕截图所示:

enter image description here

另一个错误是关于找不到主题: AppTheme。

您需要在应用程序ic_launcher文件夹的values文件夹中拥有一个styles.xml文件,如以下屏幕截图所示: enter image description here