无法使用库项目构建android项目:清单合并失败,并出现多个错误

时间:2019-11-22 06:42:20

标签: android android-studio manifest-merging

尝试使用库项目构建项目时收到此错误。

  

java.lang.RuntimeException:清单合并失败,原因是   多个错误,请参阅日志         在com.android.build.gradle.internal.tasks.manifest.ManifestHelperKt.mergeManifestsForApplication(ManifestHelper.kt:181)         在com.android.build.gradle.tasks.ProcessApplicationManifest.doFullTask​​Action(ProcessApplicationManifest.java:218)         在com.android.build.gradle.internal.tasks.IncrementalTask​​.handleIncrementalInputs(IncrementalTask​​.kt:107)         在com.android.build.gradle.internal.tasks.IncrementalTask​​.access $ handleIncrementalInputs(IncrementalTask​​.kt:64)         在com.android.build.gradle.internal.tasks.IncrementalTask​​ $ taskAction $$ inlined $ recordTaskAction $ 1.invoke(AndroidVariantTask.kt:51)         在com.android.build.gradle.internal.tasks.IncrementalTask​​ $ taskAction $$ inlined $ recordTaskAction $ 1.invoke(AndroidVariantTask.kt:31)         在com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:91)         在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction $ gradle(IncrementalTask​​.kt:134)         在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处         在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:498)         在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)         在org.gradle.api.internal.project.taskfactory.IncrementalTask​​InputsTaskAction.doExecute(IncrementalTask​​InputsTaskAction.java:47)         在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)         在org.gradle.api.internal.project.taskfactory.AbstractIncrementalTask​​Action.execute(AbstractIncrementalTask​​Action.java:25)         在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 5.run(ExecuteActionsTaskExecuter.java:476)         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)处         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)处         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ 1.execute(DefaultBuildOperationExecutor.java:165)         在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)处         在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)         在org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)         在org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)处         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access $ 200(ExecuteActionsTaskExecuter.java:93)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)         在org.gradle.internal.execution.steps.ExecuteStep.lambda $ execute $ 0(ExecuteStep.java:32)         在java.util.Optional.map(Optional.java:215)         在org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)         在org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)         在org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)         在org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)         在org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)         在org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)         在org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)         在org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)         在org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)         在org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)         在org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)         在org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)         在org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)         在org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)         在org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)         在org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)         在org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)         在org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)         在org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)         在org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)         在org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)         在org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)         在org.gradle.internal.execution.steps.SkipUpToDateStep.lambda $ execute $ 0(SkipUpToDateStep.java:89)         在java.util.Optional.map(Optional.java:215)         在org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)         在org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)         在org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)         在org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)         在org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)         在org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)         在org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)处         在org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)处         在org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)处         在org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)处         在org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)         在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)         在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)         在org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)         在org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)处         在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)         在org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)         在org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)         在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)         在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)         在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)         在org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.executeTask(EventFiringTaskExecuter.java:77)         在org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.call(EventFiringTaskExecuter.java:55)         在org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.call(EventFiringTaskExecuter.java:52)         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)处         在org.gradle.internal.operations.DefaultBuildOperationExecutor $ 1.execute(DefaultBuildOperationExecutor.java:165)         在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)处         在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)         在org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)         在org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)         在org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)         在org.gradle.execution.plan.LocalTask​​NodeExecutor.execute(LocalTask​​NodeExecutor.java:43)         在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)处         在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)处         在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)处         在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)处         在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker $ 1.execute(DefaultPlanExecutor.java:134)         在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker $ 1.execute(DefaultPlanExecutor.java:129)         在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.execute(DefaultPlanExecutor.java:202)处         在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)         在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.run(DefaultPlanExecutor.java:129)         在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)         在org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:48)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)         在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

  at java.lang.Thread.run(Thread.java:748)
     

我的清单文件看起来像这样

     

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

<application
    android:name=".TraqDataApp"
    android:allowBackup="false"
    android:fullBackupContent="@xml/backup_rules"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/appicon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true"
    tools:replace="android:appComponentFactory,android:allowBackup">
    <activity android:name=".ui.activities.SettingsActivity"
        android:label="Settings"/>
    <activity
        android:name=".ui.activities.LoginProcessActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name=".ui.activities.ForgotPasswordActivity"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustUnspecified">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ui.activities.WebViewActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".ui.activities.ChangePasswordActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".ui.activities.HomeActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".ui.SplashActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.traqiq.traqdata.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
    </provider>
</application>
     

1 个答案:

答案 0 :(得分:0)

在应用程序标记下,添加了.App_name,而为MainActivity创建了单独的活动标记。为什么这样?请在线遵循一些教程,以了解更多信息。在大多数情况下,MainActivity应该是在您运行应用程序时开始的活动。