Cannot Connect to Firebase From Android Studio using Firebase Assistant - firebase

I do have problem in connecting to Firebase from Android Studio using Firebase Assistant. It just popup this image when i try to connect to Firebase. I'm quite new to Firebase and Android Development so this is a little problem to me.
This is my build.gradle for project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com
.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-
services:4.0.1'
// 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
}
And this is my build.gradle (App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.thebooksmart.booksmart"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles
getDefaultProguardFile('proguard-
android.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'
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'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Requesting help from experts or anyone that know how to sort this

Related

Trying to write simple hello world to firebase database

I'm trying to write to my firebase Realtime database but I cannot figure why I cant. I'm just starting to implement it but I cant figure out why my .setValue()in my onCreate is not working. I've brought in my google-servies doc and i've followed the code in the tutorial in android studio but still no luck. I also dont think its an error with dependences but it still could be for all i know. I'm not getting any errors so im really at a lost. Has anybody any suggestions. Here is the relevant code:
class CreateAPostFragment : Fragment() {
var post = PostModel()
val database = FirebaseDatabase.getInstance("HERE IS MY URL TO THE DATABASE")
val myRef = database.getReference("test")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
myRef.setValue("Hello World")
println("added")
println(myRef)
}
Build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.32"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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
}
build.gradle(module)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id "kotlin-kapt"
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "ie.wit.savvytutor"
minSdkVersion 29
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation('com.google.firebase:firebase-database-ktx')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
apply plugin: 'com.google.gms.google-services'
androidTestImplementation("com.android.support.test.espresso:espresso-contrib:2.2.2") {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v7'
exclude group: 'com.android.support', module: 'design'
exclude module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
}

ERROR: Could not find method platform() for arguments [com.google.firebase:firebase-bom:29.0.1]

ERROR: Could not find method platform() for arguments [com.google.firebase:firebase-bom:29.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Tried upgrading the Gradle version, but didn't resolve.
I'm trying to connect the app with firebase.
build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.example.transportation"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation platform('com.google.firebase:firebase-bom:29.0.1')
implementation 'com.google.firebase:firebase-analytics'
}
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.3'
// 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
}
Project Structure
You need to downgrade the version of firebase to
implementation platform('com.google.firebase:firebase-bom:25.12.0')
and I found the problem on the gradle version by updated it to
classpath 'com.android.tools.build:gradle:4.1.3'
it worked fine

Failed to resolve: com.google.firebase:firebase-firestore:11.0.4 in Android Studio 3.0.1

I am using Android Studio version (3.0.1) and I installed Google Play Services and Google Repository
I tried using
maven {
url 'https://maven.google.com'
}
in project gradle
this is my project grandle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is my app build grandle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.congdong85.hn.hoangnguyen.doanungdungcast"
minSdkVersion 16
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-firestore:11.0.4'
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'
implementation 'com.android.support:design:26.1.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.android.support:cardview-v7:26.1.0'
}
apply plugin: 'com.google.gms.google-services'
and I still get message when sync
Error:(27, 20) Failed to resolve:
com.google.firebase:firebase-firestore:11.0.4
I can't sync com.google.firebase:firebase-firestore:11.0.4 plase help me.
change this:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
into this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You need to add the google() repo in the top level gradle file, as specified in the firebase docs and also it should be before jcenter()

Remove fabric and firebase from android studio project completely

I am getting struggled with errors and warnings whenever I try to remove fabric and firebase from my android studio project. I almost deleted every implementation of those from project but I still see some crashlytics in my gradle. How can I clean up these fully. I don't want any firebase/fabric in my project.
My app level Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
defaultConfig {
applicationId 'drpg.ddkeys'
minSdkVersion 19
targetSdkVersion 26
versionCode 4
versionName '4.4.42'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
versionNameSuffix 'blaze'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
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'
My Project level gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
defaultConfig {
applicationId 'drpg.ddkeys'
minSdkVersion 19
targetSdkVersion 26
versionCode 4
versionName '4.4.42'
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
versionNameSuffix 'blaze'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
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'
Mike from Fabric here. Sorry to hear you're removing Fabric and if you have feedback, please email support(at)fabric(dot)io.
From your app's build.gradle, remove:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
From your project's build.gradle, remove:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
If you see a Fabric API key in your AndroidManifest.xml, remove that value:
<meta-data
android:name="io.fabric.ApiKey"
android:value="YourKey"
/>
If you have a crashlytics.properties or fabric.properties file, remove that file.
If you see a Fabric init statement in your app, remove it. An example:
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
If you have a google-services.json file that you've used with Firebase, remove that. The beginning of the file would look like this:
"project_info": {
"project_number": "number",
"firebase_url": "firebase_url",
"project_id": "your-project-id",
}
Ultimately, the best choice is to look at your commit history when the dependencies were added and remove those. I can't give a perfect answer since Firebase and Fabric are both modular.
You can also check the Upgrade to the Firebase Crashlytics SDK. It gives you detailed instructions for removing the Fabric Crashlytics SDK and replacing it with Firebase Crashlytics.
This page gives also an overview about Fabric Crashlytics methods and their replacements in the new Firebase SDK.

Google and Firebase dependencies not resolving after Android Studio update [duplicate]

This question already has answers here:
Failed to resolve: com.google.firebase:firebase-core:11.2.0
(6 answers)
Closed 5 years ago.
I recently updated Android studio from 2.1 to 2.3.3 on Ubuntu 17.04. Additionally, I had to update my android.support dependencies from version 25.0.0 to 26.0.1 and my firebase dependencies from 9.6.1 to 11.2.0. I have tried everything on SO to no avail, including completely re-imaging ubuntu. All google/firebase dependencies still fail to resolve so It must be an error on my side. Below are my gradle files.
Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "me.myapp.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 10
versionName "0.10.1"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-storage:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
}
apply plugin: 'com.google.gms.google-services'
Project build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
try to add
maven {
url "https://maven.google.com"
}
after jcenter() like below
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

Resources