App won't work unless you update Google Play Services - android

I'm using Firebase UI and when I try to run the app, the above error is displayed.
I've tried using multiple emulator with different configurations and also different versions of Play Services in my gradle. I haven't not been able to fix this error.
This is my app/build.gradle:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.google.android.gms:play-services:11.4.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-auth:11.4.0'
compile 'com.google.firebase:firebase-core:11.4.0'
compile 'com.google.firebase:firebase-database:11.4.0'
compile 'com.firebaseui:firebase-ui-auth:2.4.0'
compile 'com.android.support:support-annotations:25.3.1'
}
apply plugin: 'com.google.gms.google-services'
The Emulator config is Nexus 5x Api 25 X86_64

Related

firebaseUI dependency not matching with the firebase version 15.0.0

firebaseUI dependency not matching with the firebase version 15.0.0 Actually what is happening is that, when I include the firebaseUI dependency , android studio shows some kind of error related to values.xml file. I have linked the picture of error below and when I remove that line everything works fine , then there is no error.
The code for the entire gradle file is given below:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
resConfigs "en"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}apply plugin: 'com.google.gms.google-services'
ERROR:
The README at FirebaseUI's github repo is quite clear. You need to explicitly override all the transitive dependencies for each UI library e.g if you are using firebase-ui-auth version 3.3.0 but want to use firebase version 15.0.0 and support libaries version 27.1.1, it will be be something like below.
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:design:27.1.1'
Try updating your setup, also firebase UI is still depedning in version 12.0.1 not 15.0.0. See the docs to see which versions match with which firebase ui versions:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
resConfigs "en"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:12.0.1'
compile 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
whatever the Firebase UI dependency you want to use, try adding below two dependencies.
It worked for me, this might work for you as well
implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"

Error "Cannot resolve symbol R" after updating firebase version

I was working on an older version of firebase and everything was working fine, then i updated it to 11.8.0 but i got errors all over the project
'Cannot resolve symbol R' in the java classes
errors from v26\values-v26.xml file in the screenshoot:
here is my gradle files:
build.gradle
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
//firebase
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.firebaseui:firebase-ui-auth:3.2.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Module:app)
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
//firebase
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.firebaseui:firebase-ui-auth:3.2.1'
}
apply plugin: 'com.google.gms.google-services'
I rebuild the project and cleaned it but nothing was solved.
Update your gradle from version 25 to 26
compileSdkVersion 25
buildToolsVersion "25.0.2"
to
compileSdkVersion 26
buildToolsVersion "26.0.1"
And dependencies
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:appcompat-v7:26.0.0'

What changes should i make in my build.gradle before releasing my android app to production

This is more of asking suggestion for changes to be made to my build.gradle as i am about to release my first android app.Searched a lot but no satisfactory solution.Here is my gradle file
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 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 19
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
resConfigs "en_US", "hi_IN"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.digits.sdk.android:digits:2.0.6#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
compile('io.fabric.sdk.android:fabric:1.3.10#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.google.firebase:firebase-storage:10.2.1'
compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile ('io.branch.sdk.android:library:2.5.9') {
transitive = true;
exclude module: 'answers-shim';
}
}
apply plugin: 'com.google.gms.google-services'
Every suggestion matters as it could also be helpful for other beginners like me who are planning to release their first build in play store.
I can see that you have enabled pro guard in your release mode. I suggest you to consider following statement from android doc
For even more code shrinking, try the proguard-android-optimize.txt file that's in the same location. It includes the same ProGuard rules, but with other optimizations that perform analysis at the bytecode level—inside and across methods—to reduce your APK size further and help it run faster.
change this
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
to this
proguardFiles getDefaultProguardFile('**proguard-android-optimize.txt**'), 'proguard-rules.pro'
Also add this to release mode
shrinkResources true
And don't forget to add pro guard rules if you haven't already.
Doing above two things will make your app small in size and more optimized.

can not resolve Firebase

i am trying to declare Firebase but it's giving error can not resolve Firebase.
i have added all the dependencies. when typing in android studio FirebaseDatabase etc are available but simple Firebase is not.
here are my dependencies
enter code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.doctor.lenovo.mvprecovery"
minSdkVersion 16
targetSdkVersion 25
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 fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Make sure you have the lastest version of Google Repository (You can update to a newer version in SDK Manager tab)

Android - Request to update to com.google.android.gms to 9.0.0

I just got back from lunch. I didn't make any changes; gradle sync ran on its own and now I have this message.
Did anyone encounter that? I had that tomorrow, built again and everything ran smoothly. I'm stuck.
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
Here my Gradle file, but really I don't get it T_T
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId '*****'
minSdkVersion 19
targetSdkVersion 23
versionCode 999999
versionName "3.0.4"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
apply plugin: 'com.google.gms.google-services'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.google.maps:google-maps-services:0.1.3'
compile 'io.card:android-sdk:5.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.orhanobut:dialogplus:1.11#aar'
compile 'com.android.support:support-v4:23.4.0'
}
apply plugin: 'com.google.gms.google-services'
Upadate your Google Play Services from sdk tools.

Categories

Resources