Image link containing screenshot of the error
I am using Kotlin for my android app. I am unable to finish my Gradle Build due to this error :
Failed to resolve: com.google.firebase:firebase-core-ktx:
I tried all possible solutions available on stackoverflow. I have already downloaded the latest google play services from the SDK manager. I placed maven{url...} in my all repositories, yet can't fix this error. Even tried adding version specification in my implementations. Please help me with this!!
This below is my build.gradle file :-
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
These are the dependencies added to the code :-
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-core-ktx'
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-database-ktx:19.6.0'
implementation 'com.google.firebase:firebase-storage-ktx'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Try this:
implementation 'com.google.firebase:firebase-core:16.0.1'
Also you can try this, if you are using the bom library.
implementation 'com.google.firebase:firebase-core'
Related
I wish to develop a chat app using firebase. However, I can't Connect to Firebase in the assistant pannel. Instead, it shows this error message
Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
I tried searching up for fix online people suggest to delete jCenter() from gradle but i don't even have this code in my file. I was able to sync my project everything seems to work fine except i couldn't connect to it.
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module gradle
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 32
defaultConfig {
applicationId "android.exercise.myExercise"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
manifestPlaceholders = [MAPS_API_KEY: "${properties.getProperty('secret-apiKey')}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.google.android.gms:play-services-maps:18.0.1'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'com.google.android.material:material:1.6.0-alpha01'
implementation 'com.github.VishnuSivadasVS:Advanced-HttpURLConnection:1.2'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// chat sys
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
}
It's a little late, but I can still help. I had the same problem. And I solved the problem
File>Project Specture>Modules
or
Ctrl+Alt+Shift+S >Modules
Compile sdk Version: 32 or latest version
Build Tools Version: 32.0.0 or latest version
then click Apply button
then click OK button
and the problem will be solved.
Sorry for my english, i don't know english.
Add MAVEN in Project gradle:
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this repository
}
After updating the Android Studio to latest while connecting to the Firebase below error is coming.
Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
Project Gradle:-
buildscript {
ext.kotlin_version = "1.4.32"
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Finally, after googling i found the solution. I have removed below line from Module Gradle and it worked.
testImplementation 'junit:junit:'
I'm trying to install the firebase database for real time database in my project but im facing an exception every time I try to run.
here's the exception I get:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find firebase-database-19.6.0.aar (com.google.firebase:firebase-database:19.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-database/19.6.0/firebase-database-19.6.0.aar
and here's the firebase database version along with the firebase core version in my pubspec:
firebase_core: ^0.7.0
firebase_database: ^6.0.0
and here's my android/build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and these are my dependencies in my app/build.gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
}
I've tried upgrading the gradle version along with the google service version to no avail I tried (flutter clean, deleting the project and coping everything to a new project) I've also tried installing this package in my other projects and it worked fine but it seems the issue is from something else in this project.
The problem was that the gradle version in the gradle/wrapper file was new and doesn't have this file (firebase-database-19.6.0.aar).
So this is what it was:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
and this is it now:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
I almost finished building my android app, but I want to add FirebaseCrashlytics. I always add this and I never had a problem installing it. But now its diffrent. I get the following error:
2021-05-24 20:41:42.807 11296-11333/com.example.depeuleschil E/FirebaseCrashlytics: Settings request failed.
java.io.FileNotFoundException: https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/1:966637647957:android:9f830999a842bf19b5fcdc/settings?instance=864af142db1afeaf05a53d2c5a0bee2a10c2f546&build_version=1&display_version=1.0&source=1
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)
at com.google.firebase.crashlytics.internal.network.HttpGetRequest.execute(HttpGetRequest.java:80)
at com.google.firebase.crashlytics.internal.settings.network.DefaultSettingsSpiCall.invoke(DefaultSettingsSpiCall.java:113)
at com.google.firebase.crashlytics.internal.settings.SettingsController$1.then(SettingsController.java:199)
at com.google.firebase.crashlytics.internal.settings.SettingsController$1.then(SettingsController.java:192)
at com.google.android.gms.tasks.zzp.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
at java.lang.Thread.run(Thread.java:923)
I have spent 2 hours on google already and on Stackoverflow there are some people that encounter the same sort of problem. But the problem is always slightly different and I have literally tried every suggesting that I could find on Stackoverflow, but nothing works.
This is the documentation I use:
https://firebase.google.com/docs/crashlytics/get-started?platform=android
I have deleted and cleared the firebase app online and tried to reinstall (3 times) but nothing works. I hope someone can help me with this problem.
This is my gradle file (app level)
plugins {
id 'com.example.test'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
//for support vector images in an imageview
vectorDrawables.useSupportLibrary = true
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'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
// cardView library
implementation 'androidx.cardview:cardview:1.0.0'
// Viewpager2
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//tablayout
implementation 'com.google.android.material:material:1.4.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.synnapps:carouselview:0.1.5'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// firebase
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
}
and this is my build.gradle (package level)
buildscript {
ext.kotlin_version = "1.4.32"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
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
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I faced a similar error. After looking at several potential solutions and even workarounds, I inspected the URL from which the settings were being attempted to be fetched. I found that my App Id was set to an old id.
Use the latest google-services.json file from your Firebase console (add it to your project).
P.S.: Do check your other related Google/Firebase tools and services after updating google-services.json in your app. This little issue was also blocking my Firebase events.
P.P.S.: +1 to #Gerardo's answer above.
I faced the same issue and checked all the ids of the app and everything was the same as firebase but when I went to the crashlytics tab on firebase I found that I didn't enable it so it worked after enabling it.
In android 9.0 and above cleartextTrafficPermitted is set to false by default
which blocks any http request sent from your app
to fix this issue you must allow domain firebase-settings.crashlytics.com
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">firebase-settings.crashlytics.com</domain>
</domain-config>
</network-security-config>
I am using the latest version of Android Studio and all plugins. I am trying to connect android app to firebase console. Successfully downloaded google-services.json file and added to module root directory. Added lines "classpath 'com.google.gms: google-services: 4.3.3" and "apply plugin:' com.google.gms.google-services'" to the build.gradle files.
build.gradle project level:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
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()
}
}
build.gradle app level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "app"
minSdkVersion 16
targetSdkVersion 29
versionCode 42
versionName "16.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// CloudPayments SDK
implementation 'ru.cloudpayments.android:sdk:1.0.5'
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-iid:20.2.4'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
}
apply plugin: 'com.google.gms.google-services'
When synchronizing the project, I get the error
No such property: applicationVariants for class: java.lang.String
which refers to the line "apply plugin: 'com.google.gms.google-services'" in build.gradle app level.
I ask for advice on how you can fix this error.
I solved this by checking all my gradle files and found out that, the gradle.properties file has some errors in it. I don’t know how they got there. But I replaced the file contents by copying the contents from a fresh android project.
Solved