I'm trying to read data from firebase but somehow I cannot sync my Gradle project.
I went to Tools -> Firebase and added Authentication and Realtime Database as a video I referred on Youtube.
But my Gradle project sync keep on fails after that.
I've searched this problem on google and tried to update my versions but it didn't work.
I also added com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true at the bottom of build.gradle file but it says it's an unnecessary qualified reference.
Here's some code.
build.gradle
// 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
}
build.gradle (Module : app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.el.ariby"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:16.0.8'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.1'
//implementation 'com.google.firebase:firebase-auth:16.2.1'
//implementation 'com.google.firebase:firebase-storage:16.1.0'
//implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
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-auth:16.0.1:15.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
UPDATE
Sorry I forgot to add error messages.
Failed to resolve: firebase-database-15.0.0
Open File
Failed to resolve: firebase-auth-15.0.0
Open File
I really wish I can sync the file..
Thank you!
Please next time provide more details of the error, per console or xlint so we can evaluate the problem.
But I've already encountered an error that prevents sync, you use different versions of libraries causing conflicts. Please note that if you use a firebase library of one version, you have to use all libraries of the same version. The error is here:
implementation 'com.google.firebase:firebase-database:15.0.1' // 15.0.1????
implementation 'com.google.firebase:firebase-auth:16.0.3' // 16.0.3???
implementation 'com.google.firebase:firebase-storage:16.0.1' //16.0.1???
example:
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.3' //this is the same version
implementation 'com.google.firebase:firebase-auth:16.0.3' //than this
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
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'
just replace this line
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
with
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
Related
good evening, i am starting in android but the projects that I have downloaded to base myself on most of them throw me errors in the grandle does anyone know why I get error in almost all dependencies? already try to "update" them to their latest version in the gradle file, the project download it from git hub.
build. gradle (Proyect)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
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()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bigohealth"
minSdkVersion 22
targetSdkVersion 28
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 = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:17.1.2'
//implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
//androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def lifecycle_version = "2.0.0"
def room_version = "2.2.0-alpha02"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.github.christophesmfvvFet:android_maskable_layout:v1.3.1'
implementation 'com trrf r.squareup.retrofit2:adapter-rxjava2:2.6.0'
implementation 'de. , tk./;cx v/8.c8x8hdodenhof:circleimageview:3.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
implementation 'com.android.volley:volley:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.gms.google-services'
Can you check, if you are under proxy and your android studio is able to connect to internet? Go to file>settings>type 'proxy' > in proxy settings there is a check connection button which will test if android studio is able to connect.
if there is a proxy, then provide the details and check again.
also make sure you do not have offline mode in your gradle settings turned on. Refer following screenshot:
Also your build tools are 4.0.1. Hope you should have the latest android studio too..
I have some problems occur on my project which is :
android.annotation cannot be resolved.
For your information, I have migrated to androidx library. I assume that all my codes will be automatically change to androidx but only some of them changed. Current Version Android Studio is 3.5.
What have I done are
Invalidate and Restart
Clean and Rebuild
All path for sdk has been selected
The application installed on my devices, but keep stopping. Here are my details:
build.gradle(project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
//classpath 'com.google.gms:google-services:3.2.0'
classpath 'com.google.gms:google-services:4.3.2'
//classpath 'com.google.gms:google-services:4.3.2'
// 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 app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.kartik.barcode"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
//implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.core:core:1.0.0'
implementation 'androidx.media:media:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
implementation 'com.google.zxing:core:3.2.0'
implementation 'com.google.firebase:firebase-database:19.1.0'//for firebase
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-storage:19.0.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.google.firebase:firebase-firestore:21.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-ads:18.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
//annotationProcessor 'androidx.annotation:annotation:1.1.0'
implementation 'com.android.support:support-annotations:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
HERE THE PROBLEMS OCCUR
logcat
When I view the java class, the import still android and not androidx. Even I changed to androidx, it still cannot be resolved.
java class
Remove this
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.android.support:support-annotations:28.0.0'
and delete yours imports once and reImport
like this
import android.annotation.SuppressLint;
I was trying to build an Android project on react-native application. Everything was working correctly until this morning. It is strange since no code was changed but build is failing. It could be something to do with internal dependency update but I was unable to figure it out.
I was trying to update compileSdkVersion to 28 but this produces more problems and I would like to avoid it if it was not completely necessary.
android/build.gradle
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 21
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
googlePlayServicesAuthVersion = "15.0.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android/app/build.gradle
dependencies {
// this is copied from
implementation('com.onesignal:OneSignal:3.10.8') {
// Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
// This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
// And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
exclude group: 'com.android.support'
// Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
}
implementation project(':react-native-onesignal')
implementation project(':appcenter')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-reanimated')
implementation project(':react-native-audio-jack')
implementation project(':react-native-firebase')
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
implementation project(':appcenter-crashes')
implementation project(':appcenter-analytics')
implementation project(':react-native-heading')
implementation project(':react-native-billing')
implementation project(':react-native-android-badge')
implementation project(':react-native-sound')
implementation project(':react-native-google-analytics-bridge')
implementation project(':react-native-bluetooth-state')
implementation project(':react-native-code-push')
implementation (project(':#mapbox_react-native-mapbox-gl')){
implementation ('com.squareup.okhttp3:okhttp:3.9.1') {
force = true
}
}
implementation project(':react-native-kontaktio')
implementation project(':realm')
implementation project(':rn-fetch-blob')
implementation project(':react-native-restart')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-keep-awake')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-i18n')
implementation project(':react-native-fs')
implementation project(':react-native-exception-handler')
implementation project(':react-native-device-info')
implementation (project(':react-native-camera')){
exclude group: "com.android.support"
}
implementation project(':react-native-android-location-services-dialog-box')
implementation project(':lottie-react-native')
implementation project(':react-native-google-signin')
implementation project(':react-native-fbsdk')
implementation project(':react-native-config')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation "com.google.firebase:firebase-invites:16.1.0"
}
I expect Android build to pass without errors.
It seems to be related to Google releasing a new version of their Play Service and as you don't want to update compileSdkVersion.
try this:
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"
for more and detailed info, you can refer this
Add below line of code in root level build.gradle file
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion '28.0.1'
}
}
}
}
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[11.0.1,11.0.1], [15.0.1,15.0.1]], but resolves to 15.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
When i am trying to add Firebase on my android project,I got this error.I have done every possible things to solve this error,but i still getting this error.Please give me some suggestion to solve this issue.
App level dependency
repositories {
maven {
url "http://dl.bintray.com/lukaville/maven"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
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 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.applozic.communication.uiwidget:mobicomkitui:5.8.4'
implementation 'com.facebook.android:facebook-login:4.28.0'
implementation 'com.facebook.android:account-kit-sdk:4.28.0'
implementation 'com.facebook.android:facebook-android-sdk:4.28.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
//noinspection GradleCompatible
implementation 'com.borjabravo:readmoretextview:2.0.1'
implementation 'com.gmail.samehadar:iosdialog:1.0'
implementation 'com.gdacciaro:iosdialog:1.0.3'
implementation 'com.wdullaer:materialdatetimepicker:3.6.0'
implementation 'com.bignerdranch.android:recyclerview-multiselect:0.2'
implementation 'com.wrapp.floatlabelededittext:library:0.0.6'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.ms-square:expandableTextView:0.1.4'
implementation 'com.nbsp:library:1.8'
implementation 'net.gotev:uploadservice:2.1'
implementation 'javax.mail:javax.mail-api:1.5.3'
implementation 'com.google.firebase:firebase-core:16.0.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'
}
apply plugin: 'com.google.gms.google-services'
project level dependency
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
I am not sure about the root cause of this problem(Probably some dark magic).
add:
import com.google.gms.googleservices.GoogleServicesPlugin
GoogleServicesPlugin.config.disableVersionCheck = true
to the app level build.gradle file.
Took the advice from:
https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37
I am frustrated that I don't understand the reason for that. But it may help.
I tried adding this dependency...
implementation 'com.google.android.gms:play-services-auth:16.0.0'
but it says:
Could not resolve com.google.android.gms:play-services-auth:16.0.0.
Here is my app level gradle file:
apply plugin: 'com.android.application'
android {
buildToolsVersion "27.0.3"
compileSdkVersion 27
defaultConfig {
applicationId "com.example.newu.fireapp"
minSdkVersion 15
targetSdkVersion 27
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.constraint:constraint layout:1.1.2'
implementation 'com.firebase:firebase-client-android:2.5.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.firebaseui:firebase-ui-database:1.1.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:21.+'
implementation 'com.android.support:recyclerview-v7:21.+'
implementation 'com.google.android.gms:play-services-auth:16.0.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'
And here's my top-level build file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Try to add this library
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
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'
//firebase stuff
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
//Google Play Services
implementation 'com.google.firebase:firebase-core:11.8.0'
If you haven't already, you need to make sure you have added the google repository to your gradle configuration:
repositories {
google()
}