Developed an application on android using firebase and ran into a problem. When I run the application on the phone in debug mode, everything works fine, as it was intended, the application loads data from the database. Further, when I assembled the apk-file, dropped it on the phone, installed it and tried to launch the application, it crashed with an error. And it flew at the moment of connecting to the database. I don’t understand what the hitch is ... The database is open for reading and editing. database rules

Here are the contents of the build.gradle files of the project and module level:

build.gradle (Project: MyProject)

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

build.gradle (Module: app)

 apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.example.nix.shedulefirebaseapp" minSdkVersion 16 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(dir: 'libs', include: ['*.jar']) 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.1.0' compile 'com.android.support:design:25.1.0' compile 'com.android.support:recyclerview-v7:25.1.0' compile 'com.google.firebase:firebase-database:9.0.0' compile 'com.firebaseui:firebase-ui-database:0.4.0' compile 'de.hdodenhof:circleimageview:2.1.0' testCompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' 
  • In theory, you should have a googleplay-services.json file in the project. Which you from the FireBase console took. Here it is necessary, in theory, to change immediately after adding the fingerprint of the release key in the project settings in the FireBase console - Juriy Spb
  • Not bad to see in the log that the error. But yes, if only the key has changed, then you need to check that a release key has been added to the Firebase console, and after that the application has updated .json - tse

1 answer 1

Most likely you have not added a release key in the Firebase console. You need to add a release key, and then download the new json file.