React Native-在包“ android”中找不到属性“ appComponentFactory”的资源标识符

时间:2018-11-02 07:29:14

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

我遇到了一个问题,每当我尝试使用react-native run-android进行构建时,构建都会失败,并出现以下错误。

  

\?\ E:\ projects \ deets-mobile-cp \ android \ app \ build \ intermediates \ manifests \ full \ release \ AndroidManifest.xml:88:   AAPT:找不到属性“ appComponentFactory”的资源标识符   在“ android”包中

     

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

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

    无法处理资源,有关详细信息,请参见上面的aapt输出。

      
  •   

我已经研究了该错误,但未能解决。怎么了我不知道。我正在使用gradle v3.1.2

有人知道发生了什么事吗

React Native v0.53.3

android / app.js

dependencies {
    compile project(':react-native-vector-icons')
    compile project(':react-native-image-picker')
    compile project(':react-native-facebook-login')
    compile project(':instabug-reactnative')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile ("com.android.support:appcompat-v7:24.2.0") {
        exclude module: 'support-v4'
    }
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile ("com.facebook.react:react-native:0.53.3") {
        force=true
    }  // From node_modules
    compile project(':react-native-picker')
    compile project(':react-native-braintree-xplat')
    compile project(':react-native-linear-gradient')
    compile project(':mapbox-react-native-mapbox-gl')
    compile ('com.android.support:multidex:1.0.0') 
    compile "com.android.support:support-v13:24.2.1"
    compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:11.8.0' //this decides your firebase SDK version
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile ("com.google.android.gms:play-services-base:11.8.0") {
      force = true;
   }
   compile ("com.google.android.gms:play-services-maps:11.8.0") {
      force = true;
   }
    compile project(':react-native-splash-screen')
    compile project(':rn-fetch-blob')
    compile project(':react-native-background-timer')
    compile(project(':react-native-google-signin')){
        exclude group: "com.google.android.gms"
    }
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile(project(':react-native-geolocation-service')) {
        exclude group: 'com.google.android.gms', module: 'play-services-location'
    }
    compile 'com.google.android.gms:play-services-location:11.8.0'
    compile project(':react-native-twilio-video-webrtc')
}

gradlew assembleRelease --stacktrace

  
      
  • 异常是:org.gradle.api.tasks.TaskExecutionException:   任务':app:processReleaseResources'的执行失败。       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)       在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)       在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)   引起原因:org.gradle.tooling.BuildException:无法处理   资源,请参阅上面的aapt输出以获取详细信息。       在com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:512)       在com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTask​​Action(LinkApplicationAndroidResourcesTask.java:249)       在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:106)       在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)
  •   

2 个答案:

答案 0 :(得分:1)

我也遇到了这个问题,我发现一个软件包引起了这个问题(更改构建工具版本和使用解析策略对我没有帮助。)所以我要做的是我一个接一个地删除了软件包并尝试构建该应用程序。幸运的是,此错误是由我使用的一个软件包触发的。所以我不得不更换它。

因此,我建议您执行相同的尝试,尝试一个接一个地删除软件包,并查看问题是否由任何软件包引起。

尝试先删除以下软件包:

compile project(':rn-fetch-blob') 
compile project(':react-native-braintree-xplat')
compile(project(':react-native-google-signin')

答案 1 :(得分:1)

我遇到了同样的问题,看看您的依赖关系,我们都使用react-native-braintree-xplat。

Braintree最近更新了该库以支持Android 28,并且问题出在此。

我不是Android专家,但您应该强制 com.braintreepayments.api升级到2.17.0版

我在我的项目build.gradle中使用

allprojects {
    repositories {
        ......
        configurations.all {
            resolutionStrategy {
                force 'com.braintreepayments.api:braintree:2.17.0'
            }
        }
        ......
    }