问题描述
我是android的新手,并且有一个应用程序在构建我的项目时出现此错误::
i am new in android and have an app that when build my project have this Error ::
我的Gradle版本是::
My Gradle build is ::
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
and 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搜索中的每个解决方案,但有人帮助了我.有人可以帮助解决此错误吗?!?!?!!?
i test every solution in stackoverflow and google search but anyone help me.can anyone help to solve this error ?!?!?!?
推荐答案
您正在使用
implementation 'com.google.firebase:firebase-messaging:19.0.1'
Firebase已在最新版本中迁移到AndroidX.这意味着您同时使用了支持库和androidx库.
Firebase migrated to AndroidX in the latest release.It means that you are using both, support libraries and androidx libraries.
您可以:
- 如下所述迁移到androidx
- 降级您的firebase依赖关系(但这不是真正的解决方案,因为您迟早要迁移)
您可以查看官方发行说明:
从Android支持库迁移到Jetpack(AndroidX)库.除非您在应用中进行以下更改,否则图书馆将无法工作:
Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:
- 将
com.android.tools.build:gradle
升级到v3.2.1或更高版本. - 将
compileSdkVersion
升级到28或更高版本. - 更新您的应用以使用Jetpack(AndroidX);请按照迁移到AndroidX 中的说明进行操作.
- Upgrade
com.android.tools.build:gradle
to v3.2.1 or later. - Upgrade
compileSdkVersion
to 28 or later. - Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
这篇关于清单合并失败:属性application @ appComponentFactory无法解决此问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!