• 4

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I noticed that this is quite common question around here so I did some research and tried to resolve this on my own, but without any positive results. So if anyone would have any ideas how to solve this problem I would really appreciate it. I have been stuck on this for hours now.

I look up into these threads:

  1. Firebase database dependecny crashes app - there I found out that I should have all my dependency versions same.
  2. Android app crashes - in this thread they suggested that I should use the latest versions depending on google official website.
  3. And also here I found the same suggestions - versions should be the same, clean and rebuild your project etc.

What I understand is the issue: The dependencies are incompatible.

NOTE: My app worked fine just with the firebase-realtime database. After adding the firebase-auth it crashes instantly (testing on Huawei P9 lite NOT on emulator).

What I have tried:

1) Making all the dependencies the newest versions. It didn’t work – still the app crashes right after start.

implementation 'com.google.firebase:firebase-core:16.0.8'

implementation 'com.google.firebase:firebase-database:16.1.0'

implementation 'com.google.firebase:firebase-auth:16.2.0'

2) Downgrading the dependencies to the closest version that they have all in common based on this link (which is 16.0.5).

implementation 'com.google.firebase:firebase-core:16.0.5'

implementation 'com.google.firebase:firebase-database:16.0.5'

implementation 'com.google.firebase:firebase-auth:16.0.5'

3) When I tried to add the firebase-auth through tools manager it inserted 'com.google.firebase:firebase-auth:16.0.3' which lead up to this error:

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0. 1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 16.0.1.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.5
-- Project 'app' depends onto com.google.firebase:firebase-iid@17.0.3
-- Project 'app' depends onto com.google.firebase:firebase-analytics@16.0.5
-- Project 'app' depends onto com.google.firebase:firebase-common@16.0.4
-- Project 'app' depends onto com.google.android.gms:play-services-stats@16.0.1
-- Project 'app' depends onto com.google.android.gms:play-services-basement@16.0.1
-- Project 'app' depends onto com.google.firebase:firebase-auth-interop@16.0.0
-- Project 'app' depends onto com.google.android.gms:play-services-flags@15.0.1
-- Project 'app' depends onto com.google.android.gms:play-services-tasks@16.0.1
-- Project 'app' depends onto com.google.firebase:firebase-measurement-connector-impl@17.0.3
-- Project 'app' depends onto com.google.android.gms:play-services-base@16.0.1
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@16.2.3
-- Project 'app' depends onto com.google.firebase:firebase-database@16.0.5
-- Project 'app' depends onto com.google.firebase:firebase-iid-interop@16.0.1
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-base@16.0.4
-- Project 'app' depends onto com.google.android.gms:play-services-ads-identifier@16.0.0
-- Project 'app' depends onto com.google.firebase:firebase-measurement-connector@17.0.1
-- Project 'app' depends onto com.google.firebase:firebase-auth@16.0.3
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@16.0.3

This is how my app level gradle file looks like:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.test123"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.google.firebase:firebase-core:16.0.5'

    implementation 'com.google.firebase:firebase-database:16.0.5'

    implementation 'com.google.firebase:firebase-auth:16.0.5'

    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'

apply plugin: 'com.google.gms.google-services'

This is my gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
    dependencies {

        // Android Gradle Plugin
        classpath 'com.android.tools.build:gradle:3.3.2'

        // Google Services Plugin
        classpath "com.google.gms:google-services:4.2.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

allprojects {
    repositories {


task clean(type: Delete) {
    delete rootProject.buildDir

And finally my logcat:

04-05 14:04:36.000 906-906/? I/art: Late-enabling -Xcheck:jni
04-05 14:04:36.192 906-906/com.example.test123 W/System: ClassLoader referenced unknown path: /data/app/com.example.test123-1/lib/arm64
04-05 14:04:36.439 906-922/com.example.test123 I/art: Background partial concurrent mark sweep GC freed 11193(638KB) AllocSpace objects, 4(80KB) LOS objects, 21% free, 15MB/19MB, paused 343us total 105.488ms at HeapTaskDaemon thread CareAboutPauseTimes 1
04-05 14:04:36.658 906-957/com.example.test123 W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
04-05 14:04:36.686 906-956/com.example.test123 I/FA: App measurement is starting up, version: 14700
04-05 14:04:36.686 906-956/com.example.test123 I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
04-05 14:04:36.686 906-956/com.example.test123 I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.example.test123
04-05 14:04:36.717 906-906/com.example.test123 I/FirebaseInitProvider: FirebaseApp initialization successful
04-05 14:04:36.723 906-961/com.example.test123 W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
04-05 14:04:36.733 906-961/com.example.test123 I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
04-05 14:04:36.733 906-961/com.example.test123 I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
04-05 14:04:37.017 906-976/com.example.test123 I/System: core_booster, getBoosterConfig = false
04-05 14:04:37.048 906-906/com.example.test123 I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
04-05 14:04:37.254 906-906/com.example.test123 W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
04-05 14:04:37.673 906-906/com.example.test123 I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
04-05 14:04:37.674 906-906/com.example.test123 I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
04-05 14:04:38.485 906-906/com.example.test123 I/Process: Sending signal. PID: 906 SIG: 9

The problem may be at your device, it might not have the google play services up to date to support the version that your app is requesting.

Try updating your google play services in your device or change to another device and test it there.

  • 1
Reply Report
    • You are welcome, search about checking Google play services in your app with code, this can prompt a dialog to the user telling.them if they need to update Google play services, instead of crashing.

Try this,it might work.

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
  • 0
Reply Report
      • 2
    • No it didn't work ... :/ Cleaned the projected, rebuild it and then installed the app into my phone. Still crashes.

When we use multiple libraries in which some of the libraries are already included by some of the libraries but with the different version no, we come across these kinds of problems. For this, you can force your gradle to use a single version of the library everywhere

configurations.all {
 resolutionStrategy {
   force "com.google.firebase:firebase-core:${VERSION_XYZ}”
   force "com.google.firebase:firebase-database:${VERSION_ABC}”
 dependencies {
   // ... all dependencies here...

Like this, do it for every library and define it in your gradle file, It might help you.

  • 0
Reply Report
    • What specific version should I target, in the ${VERSION_XYZ} brackets? The newest for all of the dependencies or same version for all of them? + should I still put my dependencies into the dependencies tree? Even tho I have specified their version in the configurations.all? If yes ... then I tried it and it doesn't work ... :/