我具有以下依赖性:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha06'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
我需要在我的应用程序中添加材料设计组件,这就是我添加此依赖项的原因:
implementation 'com.google.android.material:material:1.1.0-alpha06'
但是当我同步Gradle文件时,出现以下错误:
清单合并失败:属性application @ appComponentFactory 值=(android.support.v4.app.CoreComponentFactory)来自 [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91也位于 [androidx.core:core:1.1.0-alpha05] AndroidManifest.xml:22:18-86 值=(androidx.core.app.CoreComponentFactory)。意见建议:添加 'tools:replace =“ android:appComponentFactory”'转换为元素 在AndroidManifest.xml:6:5-21:19进行覆盖。
我添加了行
tools:replace="android:appComponentFactory"
到清单,但是在这种情况下,我会遇到以下错误:
org.gradle.execution.MultipleBuildFailures:构建完成,共1个 失败。在 org.gradle.initialization.DefaultGradleLauncher $ ExecuteTasks.run(DefaultGradleLauncher.java:386) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperation
那怎么了,我该怎么解决?
更新
我按照有问题的方式做了,可能重复。我通过以下方式更改了依存关系:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.room:room-common:2.1.0-beta01'
implementation 'androidx.room:room-compiler:2.1.0-beta01'
implementation 'com.google.android.material:material:1.1.0-alpha06'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
annotationProcessor "androidx.room:room-compiler:2.1.0-beta01"
}
但是现在我遇到另一个问题:当我打开活动的xml
文件时,我遇到了一个错误:
找不到以下类: -android.support.constraint.ConstraintLayout()将约束布局库依赖项添加到项目,修复构建路径, 编辑XML,创建类) -android.support.v7.widget.RecyclerView(修复构建路径,编辑XML,创建类)
当我构建项目时,我有这个:
org.gradle.execution.MultipleBuildFailures:构建完成,共1个 失败。在 org.gradle.initialization.DefaultGradleLauncher $ ExecuteTasks.run(DefaultGradleLauncher.java:386) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 在 org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:247) 在 org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159) 在 org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134) 在 org.gradle.internal.invocation.GradleBuildController $ 1.execute(GradleBuildController.java:58) 在 org.gradle.internal.invocation.GradleBuildController $ 1.execute(GradleBuildController.java:55) 在 org.gradle.internal.invocation.GradleBuildController $ 3.create(GradleBuildController.java:82) 在 org.gradle.internal.invocation.GradleBuildController $ 3.create(GradleBuildController.java:75) 在 org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183) 在 org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40) 在 org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75) 在 org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55) 在 org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54) 在 org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 在 org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 在 org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58) 在 org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32) 在 org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39) 在 org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner $ 3.call(RunAsBuildOperationBuildActionRunner.java:49) 在 org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner $ 3.call(RunAsBuildOperationBuildActionRunner.java:44) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101) 在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) 在 org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44) 在 org.gradle.launcher.exec.InProcessBuildActionExecuter $ 1.transform(InProcessBuildActionExecuter.java:49) 在 org.gradle.launcher.exec.InProcessBuildActionExecuter $ 1.transform(InProcessBuildActionExecuter.java:46) 在 org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78) 在 org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46) 在 org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31) 在 org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42) 在 org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28) 在 org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) 在 org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52) 在 org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59) 在 org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36) 在 org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68) 在 org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38) 在 org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37) 在 org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26) 在 org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43) 在 org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29) 在 org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60) 在 org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32) 在 org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55) 在 org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41) 在 org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48) 在 org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32) 在 org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) 在 org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74) 在 org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72) 在org.gradle.util.Swapper.swap(Swapper.java:38)处 org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62) 在 org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.FoundBuildEnvironment.doBuild(FoundBuildEnvironment.java:81) 在 org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 在 org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 在 org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50) 在 org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:295) 在 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:1142) 在 java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在 org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在java.lang.Thread.run(Thread.java:745)造成原因: org.gradle.api.tasks.TaskExecutionException:任务执行失败 ':app:processDebugAndroidTestManifest'。