gpt4 book ai didi

java - list 合并失败: Attribute application@appComponentFactory cant solve this

转载 作者:行者123 更新时间:2023-12-02 00:51:08 24 4
gpt4 key购买 nike

我是 Android 新手,并且有一个应用程序在构建我的项目时出现此错误::

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:9:5-44:19 to override.

我的 Gradle 版本是::

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "maa.tic_tac_to"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-messaging:19.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support:support-v4:28.+'
// implementation ('com.theartofdev.edmodo:android-image-cropper:2.4.+'){

// exclude group: 'com.android.support'
//}
// implementation 'com.google.android.material:material:1.0.0-alpha08'

implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
// implementation 'com.androidx.constraintlayout.widget:ConstraintLayout:2.0.0-beta2'
testImplementation 'junit:junit:4.12'
}

和manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="maa.tic_tac_to">

<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />

<application
android:allowBackup="true"
android:icon="@drawable/tic_tac_toe"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">


<activity android:name=".MainActivity"></activity>

<receiver
android:name=".MySMSReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>

<activity android:name=".FakeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LogInActivity"></activity>


<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>

</manifest>

我测试了 stackoverflow 和 google 搜索中的每个解决方案,但有人帮助我。谁能帮忙解决这个错误?!?!?!?

最佳答案

您正在使用

implementation 'com.google.firebase:firebase-messaging:19.0.1'

Firebase 在最新版本中迁移到 AndroidX。这意味着您正在使用支持库和 androidx 库。

你可以:

  • 按照如下所述迁移到 androidx
  • 降级您的 Firebase 依赖项(但这不是真正的解决方案,因为您迟早必须迁移)

您可以查看 official release notes :

Warning: This release is a MAJOR version update and breaking change. The latest update to Google Play services and Firebase includes the following changes:

从 Android 支持库迁移到 Jetpack (AndroidX) 库。除非您在应用程序中进行以下更改,否则库将无法工作:

  • com.android.tools.build:gradle 升级到 v3.2.1 或更高版本。
  • compileSdkVersion 升级到 28 或更高版本。
  • 更新您的应用以使用 Jetpack (AndroidX);按照 Migrating to AndroidX 中的说明进行操作.

关于java - list 合并失败: Attribute application@appComponentFactory cant solve this,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57858336/

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