java - app crashing at FirebaseInstanceId.getInstance().getToken() -


i´m trying token using firebaseinstanceid.getinstance().gettoken() in mainactivity.java when use method token, app stars crashing.

here's oncreate() method

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     toast.maketext(mainactivity.this, firebaseinstanceid.getinstance().gettoken(), toast.length_short).show(); } 

build.gradle (project level)

 buildscript {         repositories {             jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:2.3.3'         classpath 'com.google.gms:google-services:3.1.0'          // note: not place application dependencies here; belong         // in individual module build.gradle files     } }  allprojects {     repositories {         jcenter()     } }  task clean(type: delete) {     delete rootproject.builddir } 

build.gradle (app level)

apply plugin: 'com.android.application'  android {     compilesdkversion 25     buildtoolsversion "25.0.3"     defaultconfig {         applicationid "com.simple.app"         minsdkversion 21         targetsdkversion 25         versioncode 1         versionname "1.0"         testinstrumentationrunner "android.support.test.runner.androidjunitrunner"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } } dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', {         exclude group: 'com.android.support', module: 'support-annotations'     })           compile ('com.android.support:appcompat-v7:25.0.1')             {                 force=true             }     compile ('com.android.support.constraint:constraint-layout:1.0.2')             {                 force=true             }      compile ('com.android.support:design:25.0.1')             {                 force=true             }     compile 'com.firebaseui:firebase-ui:0.6.2'     compile 'com.squareup.picasso:picasso:2.5.2'     compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'     compile ('com.android.support:support-v4:25.3.1')             {                 force=true             }     compile ('com.google.firebase:firebase-messaging:9.2.0')             {                 force=true             }      testcompile 'junit:junit:4.12'} apply plugin: 'com.google.gms.google-services' 

logcat

07-25 20:25:20.903 4563-4563/com.simple.app d/androidruntime: shutting down vm 07-25 20:25:20.907 4563-4563/com.simple.app e/androidruntime: fatal exception: main                                                                            process: com.simple.app, pid: 4563                                                                            java.lang.nosuchmethoderror: no static method getnobackupfilesdir(landroid/content/context;)ljava/io/file; in class lcom/google/android/gms/common/util/zzx; or super classes (declaration of 'com.google.android.gms.common.util.zzx' appears in /data/app/com.simple.app-2/split_lib_dependencies_apk.apk:classes42.dex)                                                                                @ com.google.firebase.iid.zzg.zzkg(unknown source)                                                                                @ com.google.firebase.iid.zzg.<init>(unknown source)                                                                                @ com.google.firebase.iid.zzg.<init>(unknown source)                                                                                @ com.google.firebase.iid.zzd.zzb(unknown source)                                                                                @ com.google.firebase.iid.firebaseinstanceid.getinstance(unknown source)                                                                                @ com.google.firebase.iid.firebaseinstanceid.getinstance(unknown source)                                                                                @ com.simple.app.mainactivity.oncreate(mainactivity.java:138)                                                                                @ android.app.activity.performcreate(activity.java:6237)                                                                                @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)                                                                                @ android.app.activitythread.performlaunchactivity(activitythread.java:2369)                                                                                @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                                @ android.app.activitythread.-wrap11(activitythread.java)                                                                                @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                                @ android.os.handler.dispatchmessage(handler.java:102)                                                                                @ android.os.looper.loop(looper.java:148)                                                                                @ android.app.activitythread.main(activitythread.java:5417)                                                                                @ java.lang.reflect.method.invoke(native method)                                                                                @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                                @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -