Android App Crashes Unexpectedly When Trying To Run New Activity -
when try , switch activity in app, crashes. logcat when run on phone.
here activity i'm starting from:
package com.epicodus.parkr; import android.app.progressdialog; import android.content.intent; import android.graphics.typeface; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.auth.firebaseuser; import butterknife.bind; import butterknife.butterknife; public class mainactivity extends appcompatactivity implements v view.onclicklistener { private firebaseauth mauth; private progressdialog msigninprogressdialog; @bind(r.id.headline)textview mheadline; @bind(r.id.headline2) textview mheadline2; @bind(r.id.signupbutton)button msignupbutton; @bind(r.id.loginbutton) button mloginbutton; @bind(r.id.emailinput) edittext memailinput; @bind(r.id.passwordinput) edittext mpasswordinput; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // createsigninprogressdialog(); mauth = firebaseauth.getinstance(); butterknife.bind(this); typeface newfont = typeface.createfromasset(getassets(), "fonts/lobster-regular.ttf"); mheadline.settypeface(newfont); mheadline2.settypeface(newfont); msignupbutton.setonclicklistener(this); mloginbutton.setonclicklistener(this); } @override public void onclick(view v){ if(v == msignupbutton){ intent signupintent = new intent (mainactivity.this, signupactivity.class); startactivity(signupintent); }else if(v == mloginbutton){ // msigninprogressdialog.show(); login(); finish(); } } private void login(){ final string email = memailinput.gettext().tostring(); final string pass = mpasswordinput.gettext().tostring(); if(!isnotempty(email) || !isnotempty(pass)) return; mauth.signinwithemailandpassword(email, mpasswordinput.gettext().tostring()) .addoncompletelistener(this, new oncompletelistener<authresult>() { @override public void oncomplete(@nonnull task<authresult> task) { if (task.issuccessful()) { // msigninprogressdialog.dismiss(); intent loginintent = new intent (mainactivity.this, accountactivity.class); startactivity(loginintent); finish(); } else if (!task.issuccessful()){ toast.maketext(mainactivity.this, "please try again", toast.length_short).show(); finish(); } } }); } private void createsigninprogressdialog() { msigninprogressdialog = new progressdialog(this); msigninprogressdialog.settitle("loading..."); msigninprogressdialog.setmessage("signing in..."); msigninprogressdialog.setcancelable(false); } private boolean isnotempty(string email){ if(email.equals("")){ memailinput.seterror("blank field"); return false; } return true; } }
and here activity i'm trying move to:
package com.epicodus.parkr; import android.content.intent; import android.graphics.typeface; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.arrayadapter; import android.widget.button; import android.widget.listview; import android.widget.textview; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.valueeventlistener; import butterknife.bind; import butterknife.butterknife; public class accountactivity extends appcompatactivity implements view.onclicklistener { private firebaseauth mauth; private string uid; private databasereference mspecificuserreference; @bind(r.id.usernamedisplay) textview musernamedisplay; @bind(r.id.headline) textview mheadline; @bind(r.id.logoutbutton) button mlogoutbutton; @bind(r.id.findspotsbutton) button mfindspotsbutton; @override protected void oncreate(bundle savedinstancestate) { mauth = firebaseauth.getinstance(); uid = mauth.getcurrentuser().getuid(); mspecificuserreference = firebasedatabase.getinstance().getreference().child(constants.firebase_child_user).child(uid); mspecificuserreference.addvalueeventlistener(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { string username = datasnapshot.child("fullname").getvalue().tostring(); musernamedisplay.settext(username); } @override public void oncancelled(databaseerror databaseerror) { } }); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_account); butterknife.bind(this); typeface newfont = typeface.createfromasset(getassets(), "fonts/lobster-regular.ttf"); mheadline.settypeface(newfont); intent infointent = getintent(); string username = infointent.getstringextra("user"); musernamedisplay.settext(username); mfindspotsbutton.setonclicklistener(this); mlogoutbutton.setonclicklistener(this); } private void logout() { firebaseauth.getinstance().signout(); intent intent = new intent(accountactivity.this, mainactivity.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); startactivity(intent); finish(); } @override public void onclick(view view) { if(view == mlogoutbutton){ logout(); } else if (view == mfindspotsbutton){ intent findspotintent = new intent (accountactivity.this, mapsactivity.class); startactivity(findspotintent); } } }
here logcat running phone:
07-15 11:08:29.800 16082-16082/com.epicodus.parkr e/zygote: mountemulatedstorage() 07-15 11:08:29.800 16082-16082/com.epicodus.parkr e/zygote: v2 07-15 11:08:29.800 16082-16082/com.epicodus.parkr e/selinux: [debug] get_category: variable seinfo: default sensitivity: null, cateogry: null 07-15 11:08:34.574 16082-16312/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] 07-15 11:08:34.604 16082-16312/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] 07-15 11:08:35.365 16082-16082/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.crash.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] 07-15 11:08:47.557 16082-16312/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]]
and logcat emulator:
07-15 11:28:07.449 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:07.462 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:07.550 2941-2941/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.crash.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:17.925 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:22.893 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:22.895 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:23.036 2941-3090/com.epicodus.parkr e/surface: getslotfrombufferlocked: unknown buffer: 0xaa959c80 07-15 11:28:23.271 3286-3286/com.epicodus.parkr:background_crash e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.crash.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]] 07-15 11:28:32.963 2941-3074/com.epicodus.parkr e/dynamitemodule: failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.moduledescriptor" on path: dexpathlist[[zip file "/data/app/com.epicodus.parkr-2/base.apk"],nativelibrarydirectories=[/data/app/com.epicodus.parkr-2/lib/x86, /vendor/lib, /system/lib]]
here app level build.gradle file:
apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.0" defaultconfig { applicationid "com.epicodus.parkr" minsdkversion 15 targetsdkversion 24 versioncode 1 versionname "1.0" } packagingoptions { exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/dependencies' exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/license.txt' exclude 'meta-inf/license' exclude 'meta-inf/license.txt' exclude 'meta-inf/lgpl2.1' exclude 'meta-inf/notice.txt' exclude 'meta-inf/notice' exclude 'meta-inf/notice.txt' } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.google.firebase:firebase-database:9.0.0' compile 'com.google.firebase:firebase-auth:9.0.0' compile 'com.google.android.gms:play-services:9.0.0' compile 'com.firebaseui:firebase-ui-database:0.4.1' compile 'com.android.support:recyclerview-v7:+' compile 'com.google.android.gms:play-services-appindexing:9.0.0' } configurations.all { resolutionstrategy { force 'com.android.support:design:23.4.0' force 'com.android.support:support-v4:23.4.0' force 'com.android.support:appcompat-v7:23.4.0' } } apply plugin: 'com.google.gms.google-services'
and project level one:
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: delete) { delete rootproject.builddir }
first check if have prerequisites adding firebase android project:
- a device running android 2.3 (gingerbread) or newer, , google play services 9.2.1 or newer
- the google play services sdk android sdk manager (
- android studio 1.5 or higher
- an android studio project , package name
if doesn't work, check if sign in method inside firebase > auth dashboard disabled. enable , should go.
Comments
Post a Comment