I am developing an app using react native and would like to use react native fcm library but for some reason I am having difficulties building the app!
My app gradle looks as below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "fi.x.y"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
manifestPlaceholders = [
'appAuthRedirectScheme': 'fi.x.y'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "8g"
}
lintOptions {
abortOnError false
}
}
task exponentPrebuildStep(type: Exec) {
workingDir '../../'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', '.\\.expo-source\\android\\detach-scripts\\prepare-detached-build.bat'
} else {
commandLine './.expo-source/android/detach-scripts/prepare-detached-build.sh'
}
}
preBuild.dependsOn exponentPrebuildStep
repositories{
flatDir{
dirs "../../node_modules/react-native-background-geolocation/android/libs"
}
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile(project(':react-native-firebase')) {
transitive = false
}
compile project(':react-native-vector-icons')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.2'
compile 'com.google.android.gms:play-services:11.6.2'
compile 'com.google.android.gms:play-services-location:11.6.2'
compile 'com.google.android.gms:play-services-places:11.6.2'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services-ads:11.6.2'
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:11.6.2' //this decides your firebase SDK version
compile('host.exp.exponent:expoview:22.0.0#aar') {
exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
exclude group: 'com.facebook.android', module: 'audience-network-sdk'
exclude group: 'io.nlopez.smartlocation', module: 'library'
transitive = true
}
compile ('com.facebook.android:facebook-android-sdk:4.+')
compile('com.facebook.android:audience-network-sdk:4.+') {
exclude module: 'play-services-ads'
}
compile('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
compile(project(':react-native-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile(name: 'tslocationmanager', ext: 'aar') {
exclude group: 'com.google.android.gms'
}
compile "com.google.firebase:firebase-messaging:11.6.2"
}
apply plugin: 'com.google.gms.google-services'
Error I am getting in Android Studio:
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.8.0, 11.6.2, 11.6.0. Examples include com.google.android.gms:play-services-basement:11.8.0 and com.google.android.gms:play-services-ads:11.6.2 more...
With this warning it seems that the building succeed but when I try to run the app I get error saying as: Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// Point to local maven repository
url "$rootDir/../.expo-source/android/maven"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In Facebook ads dependency exclude -> gms
compile ('com.facebook.android:audience-network-sdk:4.+'){
exclude group: 'com.google.android.gms'
}
And also remove following line project level build.gradle
classpath 'com.google.gms:google-services:3.1.1'
By updating everything to 11.8.0 seemed to solve the problem the build succeeded and the app is running.
Well, I do face now Package is not running at http:192.168.168.244:19901 idk how why, eventhou it seemd to worked once! I is now complaining about the debug folder cannot delete when gradle is building!
firebase-messaging and facebook have the same dependency com.google.android.gms. They have to use the same version of gms or might lead to build fail. You should exclude them as #Ranjith Kumar said. If problem still exist (like me) then upgrade/downgrade some of them.
In my case, the latest facebook sdk TODAY is ver 4.31.0
which includes gms:11.8.0, so I've to use firebase:11.8.0 for consistent.
BUT firebase-messaging:11.8.0 has a bug about notification icon.
I've to upgrade it to firebase-messaging:12.0.0. But I can't because facebook-sdk is still using gms:11.8.0.
and I finally found a stable version of them, FYI
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
api 'com.facebook.android:facebook-android-sdk:4.11.0'
api 'com.facebook.android:account-kit-sdk:4.11.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
}
Won't recommend use this if new FacebookSDK(after 4.31.0) use gms:12.0.1.
Related
I keep receiving this Gradle error, although I did update every Gradle configurations key and I double-checked every line. I still don't understand what's the issue?
Gradle project sync failed.Basic functionality(eg editing,debugging)
will not work properly
It tells me to see the view window for error info and this in it:
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
:wrapper UP-TO-DATE
BUILD SUCCESSFUL in 0s
1 actionable task: 1 up-to-date
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
CONFIGURE SUCCESSFUL in 0s
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
quiet true
abortOnError false
ignoreWarnings true
}
configurations {
all*.exclude group: 'commons-io'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'BinaryEncoder.java'
}
defaultConfig {
applicationId 'com.xxx.xxx'
minSdkVersion 16
targetSdkVersion 26
versionCode 3
versionName '1.2'
multiDexEnabled true
ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'mips'
}
resConfigs 'en'
}
sourceSets {
main {
java {
exclude 'com.twilio:client-android:1.2.18.org.apache.http.lejacy.jar.org.apache.BinaryEncoder.java'
exclude 'org.apache.commons.codec.BinaryEncoder.java'
}
}
androidTest {
java {
exclude 'commons-codec-1.10/**'
}
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
configurations { all*.exclude group: 'com.android.support', module: 'support-v13' }
implementation fileTree(include: '*.jar', dir: 'libs')
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation('com.github.hotchemi:permissionsdispatcher:2.4.0') { exclude module: 'support-v13'}
implementation 'com.stripe:stripe-android:7.0.1'
implementation 'com.braintreepayments.api:braintree:2.7.0'
implementation 'com.braintreepayments.api:drop-in:3.1.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.github.czy1121:segmentedview:1.0.0'
implementation 'com.orhanobut:logger:2.2.0'
implementation 'com.twilio:client-android:1.2.18'
implementation 'com.squareup.okio:okio:1.11.0'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
implementation 'com.google.android.gms:play-services-gcm:11.4.0'
implementation 'com.google.android.gms:play-services-identity:11.4.0'
implementation 'com.google.android.gms:play-services-plus:11.4.0'
implementation 'com.google.android.gms:play-services-maps:11.4.0'
implementation 'lib.kingja.switchbutton:switchbutton:1.1.3'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'com.afollestad:material-camera:0.4.4'
implementation 'com.werb.pickphotoview:pickphotoview:0.3.0'
implementation 'com.github.Kennyc1012:BottomSheet:2.3.4'
implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
implementation 'com.android.support:design:26.0.1'
implementation 'com.android.support:cardview-v7:26.0.1'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.paypal.sdk:paypal-android-sdk:2.14.4'
implementation 'com.koushikdutta.ion:ion:2.1.8'
implementation 'com.afollestad.material-dialogs:core:0.8.6.0'
implementation 'com.amitshekhar.android:android-networking:1.0.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:support-v4:26.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-messaging:11.4.0'
implementation 'com.google.firebase:firebase-core:11.4.0'
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
}
apply plugin: 'com.google.gms.google-services'
UPDATE
here's the porject gradle file
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You can identify you compile configuration dependencies with the following command:
./gradlew app:dependencies --configuration compile
I noticed that Android Studio suggested an action Remove minSdkVersion and sync project and I clicked it and it fixed..! it didn't remove the line from the build.grdale file of my module though and I don't what did he mean by that action, but it's fixed anyhow.! if anyone knows more info please tell.
I am attempting to generate an apk to install to a device. I was able to do this with the same project prior to Android Studio version 3.0.0. I cannot post any error logs because the apk generates successfully, but when I try to install it on a device I get "App not installed", "File appears to be corrupt". I have been through a number of other threads to try and fix this but nothing has worked so far.
The previous version on the phone has been uninstalled.
Both Signed and unsigned have been tried.
Instant run has been disabled.
The apk has failed to install on at least 3 different devices.
I have tried downgrading my com.android.tools.build:gradle
Any help would be greatly appreciated, I feel like I've tried everything.
build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.will3596.mobileapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.2'
compile 'com.google.firebase:firebase-auth:11.6.2'
compile 'com.google.firebase:firebase-database:11.6.2'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services-location:11.6.2'
compile 'com.google.firebase:firebase-storage:11.6.2'
compile 'com.android.support:palette-v7:26.+'
compile 'com.android.support:customtabs:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:mediarouter-v7:26.+'
compile 'com.android.support:multidex:1.0.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.maps.android:android-maps-utils:0.4+'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.1.1'
// 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"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Let me know what else I can post to help get a solution.
Steps to generate debug apk from 3.0.0+
Build->Build APK(s).
I found the answer in another thread somewhere. In my android manifest, I had testOnly="true", set to false and it fixed.
I upgraded android studio to the version 3.0.1. Whenever i try to launch my app the gradle build fails and gives me the following error:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
I tried every solution possible mentioned in stack overflow but nothing is helping me out.
-Whenever i clean project no error occurs but when i rebuild the project the error come back again.
-I deleted the .gradle file and build file
-I changed from compile to implementation
-I upgraded from 10.2.1 to 11.4.2 for firebase dependencies but it gives me more error such as UNABLE TO RESOLVE DEPENDENCY
-I enabled dex but again it comes up with more errors.
-I enabled the google play services which has the version 46
I searched everthing possible but i am unable to solve this issue.
Please help me out of it as all my work is stuck.
Any help is appreciated!
build.gradle(Project)
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "studentapp.notefi"
minSdkVersion 17
targetSdkVersion 24
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'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:24.1.1'
implementation 'com.android.support:design:24.1.1'
implementation 'com.android.support:support-v4:24.1.1'
implementation 'com.android.support:recyclerview-v7:24.1.1'
implementation 'com.android.support:cardview-v7:24.1.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation 'com.google.firebase:firebase-database:10.2.1'
implementation 'com.google.firebase:firebase-storage:10.2.1'
implementation 'com.google.firebase:firebase-auth:10.2.1'
implementation 'com.firebaseui:firebase-ui-database:0.4.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.7.0'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'com.google.firebase:firebase-crash:10.2.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.6'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Please remove this line:
task clean(type: Delete) {
delete rootProject.buildDir
}
Rest i checked its working fine, i mean it successfully build.
EDITED:
use this code "com.google.android.gms:play-services:11.4.0" instead of "com.google.gms.google-services". and then clean and rebuild
Hello i am working now on android application with 2 modules the first is my app with buildgradle like
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.alexvasilkov:android-sign-release:0.8.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.alexvasilkov.sign'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "dz.condorpos"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("foldable-layout-release-key.keystore")
keyAlias "release"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
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 project(':library')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.github.barteksc:android-pdf-viewer:1.4.0'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.alexvasilkov:android-commons:2.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.afollestad:easyvideoplayer:0.3.0'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
the second module is a library included to my project here is the buildgradle(module:library):
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
}
// New version can be uploaded with 'gradlew clean :library:jar :library:uploadArchives'
apply from: 'gradle-mvn-push.gradle'
dependencies {
}
the project buildgradle is like :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects { project ->
repositories {
jcenter()
maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
}
// Enabling checkstyle for all sub projects
project == rootProject || project.afterEvaluate {
project.apply plugin: 'checkstyle'
project.extensions.getByName('checkstyle').with {
toolVersion = '6.15'
configFile file("${rootDir}/checkstyle.xml")
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java', '**/*.xml'
classpath = files()
}
project.tasks.getByName('check').dependsOn 'checkstyle'
project.extensions.getByName('android').with {
lintOptions {
ignore 'GoogleAppIndexingWarning', 'ContentDescription'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}
the project was working perfectly till yesterday when i added a compile dependencies of picasso in my app module after the gradle sync failed it show this
Error:(11, 0) Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.
now even if i remove picasso the error still happening Of course I did not ask the question before long research i found some solutions but didnt work like this
note : an old version of my project still working normal with the same clean task but after some gardle syncs i will get this problem.
I would like to thank you in advance for your assistance
After so many research i found we have to just comment the line of clean task in bulid.gradle(Project) like below :
// task clean(type: Delete) {
// delete rootProject.buildDir
// }][1]
I try to implement firebase into my app. But there is an interference between firebase and google play service.
Here is my build.gradle for the module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.nefrin.client"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.github.tajchert:nammu:1.1.3'
compile 'gun0912.ted:tedpermission:1.0.3'
compile 'com.github.jksiezni.permissive:permissive:0.2'
compile 'com.github.arimorty:floatingsearchview:2.0.3'
//compile 'net.sf.sprockets:sprockets-android:4.0.0'
compile 'com.github.michael-rapp:android-material-dialog:4.0.2'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.google.firebase:firebase-auth:11.2.0'
}
apply plugin: 'com.google.gms.google-services'
And here is build.gradle for the project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When I try to run the app I get eventhough I didn't use cardview in my app:
Error:Execution failed for task ':app:prepareComAndroidSupportCardviewV72330Library'.
> Could not expand ZIP 'C:\Users\Nefrin\.gradle\caches\modules-2\files-2.1\com.android.support\cardview-v7\23.3.0\abdf83a0192c03ff190f941c6c885af18d257a2c\cardview-v7-23.3.0.aar'.
Android Studio is underlining the compile 'com.google.android.gms:play-services:11.0.4' and says:
All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.2.0, 11.0.4. Examples include com.google.android.gms:play-services-basement:11.2.0 and com.google.android.gms:play-services:11.0.4 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
As the error says all the google libraries should use the same version.
So you should update the play-services library and use the same version as firebase:
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
You need to change this line of code:
compile 'com.google.android.gms:play-services:11.0.4'
with
compile 'com.google.android.gms:play-services:11.2.0'
Hope it helps.