1

I am using admin SDK in my app but when I sync my project I am getting error I tried to change admin SDK version but nothing has changed please help me to sync my project correctly, I have found many other solutions for this kind of error in stack overflow but they did not solve my problem

App.Gradle file

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "Myid"
    minSdkVersion 21
    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 'com.google.firebase:firebase-admin:5.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}

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

Project.gradle

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.0'

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

allprojects {
repositories {
    google()
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
Hash
  • 147
  • 1
  • 4
  • 14

1 Answers1

3

You can't use firebase-admin-sdk with:

compile 'com.google.firebase:firebase-admin:5.8.0'

in Android. Because it is for your Server not for your Android client.

Please read more at Add the Firebase Admin SDK to Your Server

From the documentation:

Prerequisites
Before you begin, make sure you have the following:

  1. If using the Admin Node.js SDK, a server running Node.js 4.0+
  2. If using the Admin Java SDK, a server running Java 7+
  3. If using the Admin Python SDK, a server running Python 2.7+ or 3.x
  4. A server app
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96