当前位置: 首页 > 知识库问答 >
问题:

如何修复android studio项目中的错误?[副本]

缪晋
2023-03-14

这是我项目错误(项目是在android studio 3.6中构建的,但我的版本是4.1.2)清单合并失败:来自[com.android.support:support-compat:28.0.0]AndroidManifest.xml:22:18-91的属性application@AppComponentFactory value=(android.support.v4.app.CoreComponentFactory)也出现在[AndroidX.Core:Core:1.5.0-Beta01]AndroidManifest.xml:24:18-86 value=(AndroidX.Core.app.CoreComponentFactory中。建议:将'tools:replace=“android:AppComponentFactory”‘添加到AndroidManifest.xml:34:5-155:19的元素中以覆盖。我的清单文件是代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:replace="android:appComponentFactory"
    package="com.efendi.coffee"
    android:versionCode="9"
    android:versionName="1.0">

    <!-- Always Required to get content and check if internet is available -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Always Required for image coaching & maps -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <!-- Required for notifications & radio -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- Required for maps -->
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- Required for visualizer & radio -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <!-- Required for tumblr -->
    <uses-permission android:name="android.permission.SET_WALLPAPER" />


    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:name="com.efendi.coffee.App"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"
        tools:ignore="GoogleAppIndexingWarning">

        <!-- Activities -->
        <activity
            android:name="com.efendi.coffee.MainActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.efendi.coffee.providers.rss.ui.RssDetailActivity" />
        <activity android:name="com.efendi.coffee.providers.youtube.ui.YoutubeDetailActivity" />
        <activity android:name="com.efendi.coffee.providers.wordpress.ui.WordpressDetailActivity" />
        <activity android:name="com.efendi.coffee.providers.woocommerce.ui.ProductActivity" />
        <activity
            android:name="com.efendi.coffee.comments.CommentsActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.HolderActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.attachmentviewer.ui.AttachmentActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.attachmentviewer.ui.AudioPlayerActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.attachmentviewer.ui.VideoPlayerActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.providers.woocommerce.ui.CheckoutActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="com.efendi.coffee.providers.woocommerce.ui.WooCommerceLoginActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
        <activity
            android:name="com.efendi.coffee.providers.tumblr.ui.TumblrPagerActivity"
            android:theme="@android:style/Theme.Holo.NoActionBar" />
        <activity
            android:name="com.efendi.coffee.providers.youtube.player.YouTubePlayerActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="sensor"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
        <activity android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
            android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>
        <activity android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
            android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>

        <!-- Services -->
        <service
            android:name="com.efendi.coffee.providers.soundcloud.player.player.PlaybackService"
            android:exported="false" />
        <service android:name="com.efendi.coffee.providers.radio.player.RadioService" />
        <service android:name="com.efendi.coffee.attachmentviewer.MusicService" />

        <!--
        A receiver that will receive media buttons and send as
        intents to your MediaBrowserServiceCompat implementation.
        Required on pre-Lollipop. More information at
        http://developer.android.com/reference/android/support/v4/media/session/MediaButtonReceiver.html
        -->
        <receiver android:name="android.support.v4.media.session.MediaButtonReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.efendi.coffee.providers.soundcloud.player.media.MediaSessionReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
            </intent-filter>
        </receiver>
        <!--<receiver android:name=".providers.soundcloud.player.player.PlayerReceiver">
            <intent-filter>
                <action android:name="android.media.AUDIO_BECOMING_NOISY" />
            </intent-filter>
        </receiver>-->

        <!-- Meta Data -->
        <meta-data
            android:name="com.onesignal.NotificationOpened.DEFAULT"
            android:value="DISABLE" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_android_key" />

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

        <provider android:authorities="${applicationId}.firebaseinitprovider"
            android:name="com.google.firebase.provider.FirebaseInitProvider"
            android:exported="false"
            tools:node="remove"/>


    </application>

</manifest>

共有1个答案

闽经纬
2023-03-14

它在日志中暗示自己,这样做

建议

tools:replace="android:appComponentFactory" to element at AndroidManifest.xml
 类似资料: