I have an Application which is connected to firebase.The problem is when install the app in device(working on several devices).I read a lot of forums and no one works.I read
In AndroidStudio try to do this:
- ctrl+alt+s
- Click on "Build, Execution, Deployment
- disable "Instant Run"
This should work
Disabling instant run fixed the issue for me.
Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run
-Uncheck the box next to "Enable Instant Run..."
-Click OK
If you have recently changed the firebase dependency version in your gradle you may need to update to the latest version of Google Repository in the Android SDK manager as well.
If you cannot update the Google Repository at the time, try changing the gradle dependency version back to lower.
I have also faced same problem with Firebase when run application below API 19(< 4.4.2) devices due to error of Multidex
. Then below solution work for me:
In app module build.gradle
android {
...
defaultConfig {
multiDexEnabled true
...
}
}
dependencies {
// add dependency
compile 'com.android.support:multidex:1.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
update name in AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".MyApplication"
android:theme="@style/AppTheme">
// ...
</application>
Crate a MyApplication.java file
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Just insert below lines in your project AndroidManifest.xml
file,
if they're not in application tag
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
I'm having the same issue, what i did is uninstall the app from device/emulator, and then, reinstall it again (from Android Studio, 'run' button).