0

将项目更新为 RN 后构建失败^0.55.4

似乎问题与react-native-config依赖 Android BuildVersion有关23.0.1

androidbin 已弃用,我们将使用它sdkmanager

$ ~/Android-sdk/tools/bin/sdkmanager --version

26.1.1

一些依赖版本:

"react": "^16.3.2",
"react-native": "^0.55.4",
"react-native-calendars": "^1.19.3",
"react-native-config": "^0.11.5",

编译错误:

Merging result:SUCCESS
Merged manifest saved to /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/intermediates/bundles/release/AndroidManifest.xml
:react-native-config:processReleaseManifest (Thread[main,5,main]) completed. Took 0.116 secs.
:react-native-config:processReleaseResources (Thread[main,5,main]) started.
:react-native-config:processReleaseResources
Executing task ':react-native-config:processReleaseResources' (up-to-date check took 0.016 secs) due to:
  Output file /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/intermediates/incremental/processReleaseResources has changed.
  Output file /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release has changed.
  Output file /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release/com has been removed.
All input files are considered out-of-date for incremental task ':react-native-config:processReleaseResources'.
Starting process 'command '/home/paneladm/Android-sdk/build-tools/23.0.1/aapt''. Working directory: /home/paneladm/my-react-native-app/node_modules/react-native-config/android Command: /home/paneladm/Android-sdk/build-tools/23.0.1/aapt package -f --no-crunch -I /home/paneladm/Android-sdk/platforms/android-23/android.jar -M /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/intermediates/manifests/aapt/release/AndroidManifest.xml -S /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/intermediates/res/merged/release -m -J /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release --custom-package com.lugg.ReactNativeConfig --non-constant-id -0 apk --output-text-symbols /home/paneladm/my-react-native-app/node_modules/react-native-config/android/build/intermediates/bundles/release --no-version-vectors
:react-native-config:processReleaseResources FAILED
:react-native-config:processReleaseResources (Thread[main,5,main]) completed. Took 0.123 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-config:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

回购中的更多描述

https://github.com/luggit/react-native-config/issues/254

编辑 - 这是一个 RN 问题

现在我知道这是一个 ReactNative 问题,所以我创建了一个:

https://github.com/facebook/react-native/issues/19467

请问有人可以帮助我吗?

4

1 回答 1

0

Try add android.enableAapt2=false in android/gradle.properties.
Ref: https://github.com/facebook/react-native/issues/16906

Or add this in android/app/build.gradle

subprojects {
  project.configurations.all {
      afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 26
                buildToolsVersion '26.0.2'
            }
        }
    }
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "26.0.2"
        }
     }
  }
}

26.0.2 is the version used in /android/app/build.gradle buildToolsVersion For Gradle v4.4, the minimum version is 27.0.3.

Ref: https://github.com/facebook/react-native/issues/19239

于 2018-05-27T14:03:57.160 回答