I am trying to connect Firebase project to my app. But when I add "classpath" com.google.gms: google-services: 4.3.4" AS is giving this error:
Cause: unable to find valid certification path to requested target
What should I do?
build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app):
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.vogella.findpeople"
minSdkVersion 14
targetSdkVersion 30
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.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-auth:19.4.0'
implementation 'com.google.firebase:firebase-database:19.5.0'
}
The link I flagged should work for you. Try this
classpath 'com.google.gms:google-services:4.3.3'
Replace your classpath with this and resync.
Try to move your apply plugin: lines to the app build.gradle file instead of the project one
I had a similar problem with regard to adding this classpath 'com.google.gms:google-services:4.3.4' but it seems like I had a bad internet connection, and when I had a strong internet connection, this error occurred,
it also occurred to me that that error was also due to a poor internet connection, after I fixed that then this error occurred,
this was because I included this implementation platform('com.google.firebase:firebase-bom:26.0.0') in build.gradle file within the app directory. So I commented it out and now I was able to run the flutter app in my android device. Like this,
Related
this is my build.gradle(.app) file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.moviebookingapp"
minSdkVersion 27
targetSdkVersion 29
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.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-database:19.5.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation'com.android.support:recyclerview-v7:29.3.1'
implementation 'com.basgeekball:awesome-validation:1.3'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation'com.google.firebase:firebase-database:19.5.1'
}
this is my build.gradle(movie booking app) file
// 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:4.1.0'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
google-services(1).json is the file which I have added
this is error is coming.
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
D:\ankita\android\moviebookingapp2\app\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnull\google-services.json
D:\ankita\android\moviebookingapp2\app\src\debug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnullDebug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnull\debug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\debug\nullnull\google-services.json
I tried many other approaches, I also searched that the file is added or not, all I have searched, I don't know where I went wrong.
I ran into this issue at the start when I created my project. Make sure you have the proper json file added. Your current json file says "google-services(1).json". The app doesn't recognize the (1) and so it thinks it is a different file. Rename that to "google-services.json" and your code should work. It' kinda annoying that they are treated differently and I spent a lot of time at the start working this out too.
Before: google-services(1).json
After: google-services.json
Please help me...
I want to create a project based on Google Maps. But after building gradle in Android Studio, The following error occurs:
ERROR:
Failed to resolve: com.google.android.gms:play-services-maps:17.0.0
Install Repository and sync project
Show in Project Structure dialog
Affected Modules: app
When i clicked on the 'Install Repository and ...' then this message appear:
Could not find dependency "com.google.android.gms:play-services-maps:17.0.0"
NOTE:
Gradle work online mode.
I went to Setting and Android SDK then downloaded google play services.. but it is not working for me.
I also set up a proxy.
EDIT:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 29
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
root gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
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 {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After much effort, I was able to solve the problem.
Strange as it may seem, the problem was solved by manually adjusting the proxy.
thanks all.
i'm using android 3.0.1. i began use firebase with android. after adding json file and updating both gradle file , i have got error message at the top of screen: Gradle project sync failed:Basic functionality (eg. editing , debugging) will not work. and down in the thin bar below : Gradle failed: ASCII as seen at below pic
error image
when i clicked Open File link occur below at pic,it opens build.gradle(Module: app).
To solve this issue, i have tried :
1- use gradle 4.4.1 instead of current one (file->settings->Gradle->use local gradle distribution).
2 -downgrade com.google.gms:google-services 4.3.0 or 4.2.0 - current is 4.3.3
but all useless.
any idea?
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.0.1'
// classpath 'com.android.tools.build:gradle:4.4'
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
}
build .gradle(Module)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.abdalla.home.ecommerce"
minSdkVersion 23
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'
// compile 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.2.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'
}
i changed dependency at gradle.build - Project as follows :
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
}
took a long time to sync successfully but succeeded at the end. i could not understand the logic behind.
I have seen some similar questions related to this error. But I wasn't able to solve the problem. I am using firebase ml kit to recognize text from an image. I have added the google-services.json file to the app directory, but still, I got the same error. If anyone can solve this issue please let me know.
I have got the following error:
File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnullDebug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\google-services.json
My build.gradle for project :
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.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
}
My build.gradle for app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.shakil.com.datafactor"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.+'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ml-vision:19.0.2'
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'
This question was answered by (I presume) the original poster:
"Yeah i found the answer.I misplaced the json file.Try to put the json file in the right directory. I just moved the json file from project level to app level. – Sakhawat Hossain Oct 22 '19 at 9:30".
I am trying to connect my android project to firebase. It was working also properly in starting. I don't know what happened all by sudden i am got series of Unresolved dependencies.
I have done almost all steps which I found over web. Like disable offline work, Invalidate chache/restart. Even when I am creating new project I am facing same problem. Earlier this all things were not happening.
My application gradle code is :
// 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'
}
}
allprojects {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle for module
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.aabsys.metasensing"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "2.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'])
//noinspection GradleCompatible
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.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
apply plugin: 'com.google.gms.google-services'
Thanks in advance.Please find image
Try adding the following dependency in your code:-
implementation 'com.google.android.gms:play-services:12.0.1'
If it still does not resolve your issue, try updating Google play services and Google repository.
Try to change the class path
classpath 'com.google.gms:google-services:4.2.0'
I solved my issue by reducing google service version to :
classpath 'com.google.gms:google-services:4.0.0'
And removing
implementation 'com.google.firebase:firebase-core:16.0.1'