我正在使用setToken(FirebaseInstanceId.getInstance().getToken())
代码来获取令牌,但出现以下错误
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzv;
dependencies {
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'android.arch.lifecycle:extensions:1.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
//noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
implementation 'pub.devrel:easypermissions:0.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0-rc02'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'net.bohush.geometricprogressview:geometricprogressview:1.1.1'
implementation project(path: ':andoird-sdk')
implementation project(path: ':opentok-android-sdk-2.16.3')
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
上面的代码是我的build.gradle。帮我解决问题。
您需要使用 FirebaseMessagingService 来获取令牌 .. 您将获得令牌到它自己的方法中
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onNewToken(final String token) {
/// you will get token here you
enter code here
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句