2

I'm having trouble getting the Realtime Database add-on to work. The classes in this package (i.e. com.google.firebase.database.*) just don't appear on the classpath. The other add-ons are not affected. I tried this with 3 projects now, one it being the quickstart-android sample project from https://firebase.google.com/docs/samples/ (the only change I made was to put the google-services.json into the ./app folder) It appears like a bug to me but I haven't found any other source reporting this issue.

Classes missing and not classes listed in the library section build.gradle:

buildscript {
  repositories {
    jcenter()
    mavenLocal()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
  }
}

allprojects {
  repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    mavenLocal()
  }
}

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

./app/build.gradle:

apply plugin: 'com.android.application'

android {
   compileSdkVersion 24
   buildToolsVersion "24.0.1"

   defaultConfig {
     applicationId "com.google.firebase.quickstart.database"
     minSdkVersion 9
     targetSdkVersion 24
     versionCode 1
     versionName "1.0"
   }

   buildTypes {
     release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.debug
     }
   }
 }

dependencies {
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:24.1.0'
  compile 'com.android.support:recyclerview-v7:24.1.0'
  compile 'com.android.support:cardview-v7:24.1.0'
  compile 'com.android.support:design:24.1.0'

  compile 'com.firebaseui:firebase-ui-database:0.4.0'

  compile 'com.google.firebase:firebase-auth:9.2.1'
  compile 'com.google.firebase:firebase-database:9.2.1'
}

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

What I tried so far:

  • Reinstalled Android Support Repository, Google Repository, Play Services
  • Upgraded to latest SDK
  • Clean Project, Rebuild Project
  • Restarted Windows and Android Studio

Things to notice:

  • I'm not hitting the 65336 methods limit (How to shrink code - 65k method limit in dex)
  • The missing package hierarchy below the firebase-database library import (see image) as compared to the other libraries there
  • google-services.json does not contain any obvious information about the Realtime Database (although I configured the DB in the Firebase console) and redownlaoded it. I'm not sure whether there should be information about it or not (file is from my project, not from the sample):

google-services.json:

{
  "project_info": {
  "project_number": "...",
  "firebase_url": "....",
  "project_id": "...",
  "storage_bucket": "..."
},
  "client": [
  {
  "client_info": {
    "mobilesdk_app_id": "...",
    "android_client_info": {
      "package_name": "..."
    }
  },
  "oauth_client": [
    {
      "client_id": "...",
      "client_type": 3
    }
  ],
  "api_key": [
    {
      "current_key": "..."
    }
  ],
  "services": {
    "analytics_service": {
      "status": 1
    },
    "appinvite_service": {
      "status": 1,
      "other_platform_oauth_client": []
    },
    "ads_service": {
      "status": 2
    }
  }
}
  ], "configuration_version": "1"
}

What could be the issue and how to proceed diagnosing?

1
  • 1
    I resolved the issue by installing a new version of Android Studio and starting with a new configuration. I'm not sure what exactly the cause was but I presume it might be corrupted cache files or the like.
    – user462982
    Jul 20, 2016 at 21:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.