问题
When I add firebase cloud messaging depencency implementation 'com.google.firebase:firebase-messaging:16.0.1' I get a error : ERROR: Failed to resolve: com.google.firebase:firebase-messaging:16.0.1
My Depencency here:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.android.support:design:28.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation "com.google.firebase:firebase-auth:16.0.1"
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:16.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'me.spark:submitbutton:1.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
How I can solved it? Please help me..
回答1:
You're trying to use use very old Firebase client libraries. The latest versions are listed in the release notes. You should make sure to use all the most recent versions together.
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
You should also no longer use firebase-core. If you are trying to use Analytics, do this instead:
implementation 'com.google.firebase:firebase-analytics:17.2.2'
回答2:
You have to update the latest Firebase Messaging. Refer to this link https://firebase.google.com/docs/android/setup#available-libraries
Cloud Messaging com.google.firebase:firebase-messaging:20.1.0
implementation 'com.google.firebase:firebase-messaging:20.1.0'
Make sure to use the latest ver lib.
Alternatively, you can press every lib there ALT + Enter, and it will display if you want to use update new version
来源:https://stackoverflow.com/questions/60161586/error-failed-to-resolve-com-google-firebasefirebase-messaging16-0-1