0

I am building an app with Firebase Realtime Database. When I run the app on my simulator, it works fine. But when i run the app on my phone, it does not works. I update google play service on my phone. But nothing works...


build app :module

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.orient"
        minSdkVersion 15
        targetSdkVersion 26
        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(include: ['*.jar'], dir: 'libs')
    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:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.google.firebase:firebase-database:10.0.1'
    testCompile 'junit:junit:4.12'
}


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

build app :project

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.orient">

    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".ScrollingActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

MainActivity

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        FirebaseDatabase database = FirebaseDatabase.getInstance();
        DatabaseReference myRef = database.getReference();
        myRef.setValue("Hello, Galaxy!");

    }

I took SHA1 key, package name from android studio and paste to firebase console. Also change firabase database rules

{
  "rules": {
    ".read": true,
    ".write": true
  }
}
Rohan Stark
  • 2,346
  • 9
  • 16
Benfactor
  • 543
  • 4
  • 11
  • 31
  • What do you mean it does not work? Do you have an error? – Alex Mamo Sep 25 '17 at 11:21
  • Database not updating. App not crashes – Benfactor Sep 25 '17 at 11:23
  • Try to call setValue with callback. There are error argument, take a look on it. – Yev Kanivets Sep 25 '17 at 11:36
  • Failed to load module via fast routecom.google.android.gms.dynamite.DynamiteModule$zza: V2 version check failed Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6 Selected remote version of com.google.android.gms.firebase_database, version >= 6 ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/arm No Network Security Config specified, using platform default – Benfactor Sep 25 '17 at 12:03

1 Answers1

0

Here is the thread, which are dedicated to the same problem you have - Android Firebase DynamiteModule: Failed to load module descriptor.

Yev Kanivets
  • 1,780
  • 3
  • 22
  • 38