React Native:com.android.ide.common.process.ProcessException:无法执行aapt

时间:2018-12-13 17:34:10

标签: android react-native gradle react-native-android

每次尝试implementation我的应用时,我都会遇到此错误:

assembleRelease

这是个例外,已经使用--stacktrace选项运行了此

FAILURE: Build failed with an exception.

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

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

这是我的 package.json

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-billing:verifyReleaseResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        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:256)
        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:249)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
        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:663)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:59)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:130)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:336)
        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.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:210)

我已经尝试设置此选项:

{
  "name": "MyApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@ptomasroos/react-native-multi-slider": "0.0.12",
    "firebase": "^5.1.0",
    "javascript-time-ago": "^1.0.30",
    "mobx": "^4.1.1",
    "mobx-react": "^5.0.0",
    "native-base": "^2.8.1",
    "prop-types": "^15.6.2",
    "protobufjs": "^6.8.8",
    "qs": "6.6.0",
    "react": "16.2.0",
    "react-native": "^0.57.7",
    "react-native-actionsheet": "^2.3.0",
    "react-native-aws3": "0.0.8",
    "react-native-axios": "^0.17.1",
    "react-native-billing": "^2.9.1",
    "react-native-card-stack-swiper": "^1.0.5",
    "react-native-collapsible": "^0.10.0",
    "react-native-cookies": "^3.2.0",
    "react-native-datepicker": "^1.6.0",
    "react-native-dropdownalert": "^3.5.0",
    "react-native-elements": "^0.19.0",
    "react-native-event-listeners": "^1.0.3",
    "react-native-expandable-section-flatlist": "^1.0.3",
    "react-native-fbsdk": "^0.8.0",
    "react-native-fcm": "^16.0.0",
    "react-native-floating-action": "^1.10.1",
    "react-native-geocoding": "^0.3.0",
    "react-native-gifted-chat": "^0.4.3",
    "react-native-google-places-autocomplete": "^1.3.6",
    "react-native-hide-show-password-input": "^1.0.7",
    "react-native-image-crop-picker": "^0.19.3",
    "react-native-image-picker": "^0.26.10",
    "react-native-image-placeholder": "^1.0.14",
    "react-native-instagram-login": "https://github.com/hungdev/react-native-instagram-login.git#4d59878c8284ae1c90b26d801d25b4a405264494",
    "react-native-keyboard-aware-scroll-view": "^0.4.4",
    "react-native-keyboard-aware-scrollview": "^2.0.0",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-linear-gradient": "^2.4.0",
    "react-native-linkedin": "^1.3.1",
    "react-native-localization": "^2.0.0",
    "react-native-material-bottom-navigation": "^0.9.0",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-open-settings": "^1.0.1",
    "react-native-pages": "^0.7.0",
    "react-native-permissions": "^1.1.1",
    "react-native-picker-select": "^5.1.0",
    "react-native-popup-menu": "^0.13.2",
    "react-native-pulse": "^1.0.6",
    "react-native-scrollable-tab-view": "^0.10.0",
    "react-native-share": "^1.0.26",
    "react-native-simple-toast": "0.0.8",
    "react-native-snap-carousel": "^3.7.2",
    "react-native-splash-screen": "^3.1.1",
    "react-native-star-rating": "^1.0.9",
    "react-native-swipe-cards": "^0.1.1",
    "react-native-swipe-list-view": "^1.0.7",
    "react-native-swipeable-flat-list": "0.0.5",
    "react-native-swipeout": "^2.3.3",
    "react-native-switch": "^1.4.0",
    "react-native-twitter-signin": "https://github.com/GoldenOwlAsia/react-native-twitter-signin.git#b2e9e60b134d0ab9411ba4045fa4ee3efbdffa58",
    "react-native-view-more-text": "^2.0.1",
    "react-native-viewpager": "^0.2.13",
    "react-navigation": "^1.0.3",
    "rn-viewpager": "^1.2.9",
    "scheduler": "0.11.3"
  },
  "devDependencies": {
    "@babel/plugin-proposal-decorators": "^7.2.0",
    "babel-jest": "22.2.2",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.2.2",
    "metro-react-native-babel-preset": "^0.48.5",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
  }
}

在我的 gradle.properties 文件中

这是我的 build.gradle

android.enableAapt2=false

1 个答案:

答案 0 :(得分:0)

我的解决方案可以帮助我实现0.54原生反应

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}