java.lang.RuntimeException:清单合并失败,出现多个错误,请参阅日志

时间:2018-12-02 10:43:33

标签: java android

合并错误: 错误:在属性:android:appComponentFactory的第9行指定了tools:replace,但未在应用主清单(此文件)的第8行中指定新值错误:验证失败,退出了应用主清单(此文件)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.lsa.lgu.lsa">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:appComponentFactory"
        tools:ignore="AllowBackup,GoogleAppIndexingWarning">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".LoginActivity" />
        <activity android:name=".RegisterActivity" />
        <activity android:name=".SettingsActivity" />
        <activity android:name=".GroupChatActivity"/>
        <activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat"/>
    </application>

</manifest>

2 个答案:

答案 0 :(得分:0)

在大多数情况下,您会发现它是您已导入的库,请共享您的应用程序级别的build.gradle文件。发生这种情况的另一种情况是,如果您要迁移到AndroidX,但尚未在gradle.properties中正确配置它。共享应用级别build.gradle的这两种情况都可以帮助您找到解决方案

答案 1 :(得分:-1)

def do_something():
    print("This works!")

@contextlib.contextmanager
def conditional_on(condition, f):
    if condition:
        # Acquire resources here
        pass
    else:
        # Replace the callable with a do-nothing dummy
        f = lambda x: x
    try:
        yield f
    finally:
        if condition:
            # Release resources here
            pass    

with conditional_on(True, do_something) as f:
    f()  # Prints message

with conditional_on(False, do_something) as f:
    f()  # Does nothing