gpt4 book ai didi

android - React-Native 构建失败 - 无法确定任务 ':app:mergeDebugAssets' 'react-native-iap' 的依赖关系

转载 作者:行者123 更新时间:2023-12-05 00:13:09 28 4
gpt4 key购买 nike

我退出了 expo 并做了 yarn android。构建失败并出现以下错误。

我做到了,

  1. ./gradle clean
  2. 删除 npm 模块并重新安装
  3. 重启电脑
  4. 将 gradle 版本更新到最新版本 -> 7.0.2
  5. 将 react-native-iap 更新到最新版本 -> 6.2.0

这些都不能解决这个问题。有谁知道为什么会这样?

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergemyapppackageDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:myapppackageDebugRuntimeClasspath'.
> Could not resolve project :react-native-iap.
Required by:
project :app
> The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'default' with value 'myapppackage'. However we cannot choose between the following variants of project :react-native-iap:
- amazonDebugRuntimeElements
- playDebugRuntimeElements
All of them match the consumer attributes:
- Variant 'amazonDebugRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Unmatched attributes:
- Provides attribute 'com.android.build.api.attributes.VariantAttr' with value 'amazonDebug' but the consumer didn't ask for it
- Doesn't say anything about default (required 'myapppackage')
- Provides attribute 'store' with value 'amazon' but the consumer didn't ask for it
- Variant 'playDebugRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Unmatched attributes:
- Provides attribute 'com.android.build.api.attributes.VariantAttr' with value 'playDebug' but the consumer didn't ask for it
- Doesn't say anything about default (required 'myapppackage')
- Provides attribute 'store' with value 'play' but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'amazonDebugApiElements' capability My App:react-native-iap:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'amazonReleaseApiElements' capability My App:react-native-iap:unspecified:
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'amazonReleaseRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playDebugApiElements' capability My App:react-native-iap:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playReleaseApiElements' capability My App:react-native-iap:unspecified:
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playReleaseRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')

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

* Get more help at https://help.gradle.org

BUILD FAILED in 29s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installmyapppackageDebug -PreactNativeDevServerPort=8081

error Command failed with exit code 1.

无法解析项目:react-native-iap:无法确定任务“:app:mergeAlaccountingmodelmcqenudeDebugAssets”的依赖关系。

react-native-iap 版本

6.2.0

react-native版本

0.63.4

您遇到错误的平台(IOS 或 Android 或两者?)

安卓

预期行为

应该构建项目。

实际行为

低于错误并且构建失败。

运行 ./gradlew app:installMyapppackageDebug -PreactNativeDevServerPort=8081 --stacktrace

* What went wrong:
Could not determine the dependencies of task ':app:mergemyapppackageDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:myapppackageDebugRuntimeClasspath'.
> Could not resolve project :react-native-iap.
Required by:
project :app
> The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'default' with value 'myapppackage'. However we cannot choose between the following variants of project :react-native-iap:
- amazonDebugRuntimeElements
- playDebugRuntimeElements
All of them match the consumer attributes:
- Variant 'amazonDebugRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Unmatched attributes:
- Provides attribute 'com.android.build.api.attributes.VariantAttr' with value 'amazonDebug' but the consumer didn't ask for it
- Doesn't say anything about default (required 'myapppackage')
- Provides attribute 'store' with value 'amazon' but the consumer didn't ask for it
- Variant 'playDebugRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Unmatched attributes:
- Provides attribute 'com.android.build.api.attributes.VariantAttr' with value 'playDebug' but the consumer didn't ask for it
- Doesn't say anything about default (required 'myapppackage')
- Provides attribute 'store' with value 'play' but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'amazonDebugApiElements' capability My App:react-native-iap:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'amazonReleaseApiElements' capability My App:react-native-iap:unspecified:
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'amazonReleaseRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playDebugApiElements' capability My App:react-native-iap:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playReleaseApiElements' capability My App:react-native-iap:unspecified:
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')
- Variant 'playReleaseRuntimeElements' capability My App:react-native-iap:unspecified declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
- Other compatible attribute:
- Doesn't say anything about default (required 'myapppackage')

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

* Exception is:
org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':app:mergemyapppackageDebugAssets'.
at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:71)
at org.gradle.execution.plan.TaskDependencyResolver.resolveDependenciesFor(TaskDependencyResolver.java:46)
at org.gradle.execution.plan.LocalTaskNode.getDependencies(LocalTaskNode.java:155)
at org.gradle.execution.plan.LocalTaskNode.resolveDependencies(LocalTaskNode.java:123)
at org.gradle.execution.plan.DefaultExecutionPlan.doAddNodes(DefaultExecutionPlan.java:171)
at org.gradle.execution.plan.DefaultExecutionPlan.addEntryTasks(DefaultExecutionPlan.java:135)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.addEntryTasks(DefaultTaskExecutionGraph.java:160)
at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:49)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:55)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:26)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:63)
at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:45)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:55)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:26)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:63)
at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:48)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:55)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.lambda$select$0(DefaultBuildConfigurationActionExecuter.java:42)
at org.gradle.internal.Factories$1.create(Factories.java:31)
at org.gradle.api.internal.project.DefaultProjectStateRegistry.withMutableStateOfAllProjects(DefaultProjectStateRegistry.java:141)
at org.gradle.api.internal.project.DefaultProjectStateRegistry.withMutableStateOfAllProjects(DefaultProjectStateRegistry.java:128)
at org.gradle.execution.DefaultBuildConfigurationActionExecuter.select(DefaultBuildConfigurationActionExecuter.java:40)
at org.gradle.initialization.DefaultTaskExecutionPreparer.prepareForTaskExecution(DefaultTaskExecutionPreparer.java:38)
at org.gradle.initialization.BuildOperationFiringTaskExecutionPreparer$CalculateTaskGraph.populateTaskGraph(BuildOperationFiringTaskExecutionPreparer.java:117)
at org.gradle.initialization.BuildOperationFiringTaskExecutionPreparer$CalculateTaskGraph.run(BuildOperationFiringTaskExecutionPreparer.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.initialization.BuildOperationFiringTaskExecutionPreparer.prepareForTaskExecution(BuildOperationFiringTaskExecutionPreparer.java:56)
at org.gradle.initialization.DefaultGradleLauncher.prepareTaskExecution(DefaultGradleLauncher.java:233)
at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:167)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:72)
at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:67)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:213)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:56)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:77)
at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.lambda$execute$0(InProcessBuildActionExecuter.java:54)
at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:53)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.lambda$execute$0(BuildTreeScopeLifecycleBuildActionExecuter.java:33)
at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:49)
at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:32)


* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings

最佳答案

您必须对 android/app/build.gradle 进行更改:

根据您支持的商店,您有两种选择:

一个。如果您只需要 Google Play IAP,请将其插入 android/app/build.gradle 中的 defaultConfig 部分:

defaultConfig {
...
// react-native-iap: we only use the Google Play flavor
missingDimensionStrategy 'store', 'play'
}

如果您同时将它用于 Google Play 和 Amazon,请在 android/app/build.gradle 的 android block 中插入以下行

android {
...
flavorDimensions "appstore"
productFlavors{
googlePlay{
dimension "appstore"
missingDimensionStrategy "store", "play"
}
amazon{
dimension "appstore"
missingDimensionStrategy "store", "amazon"
}
}
}

来自库文档:https://react-native-iap.dooboolab.com/docs/manual_install/

关于android - React-Native 构建失败 - 无法确定任务 ':app:mergeDebugAssets' 'react-native-iap' 的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67941766/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com