This is my build.gradle(Module:App) code
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mashitha.smartwaterbottle"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:11.4.0'
implementation 'com.google.firebase:firebase-storage:11.4.0'
implementation 'com.google.firebase:firebase-auth:11.4.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'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'pub.devrel:easypermissions:0.3.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev328-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.jjoe64:graphview:4.2.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
compile 'me.itangqi.waveloadingview:library:0.3.5'
//Google play services
compile 'com.google.android.gms:play-services:11.4.0'
}
apply plugin: 'com.google.gms.google-services'
I get this Error, when i sync the project.
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 11.4.0.
Please Give an answer for fixed this error.
Thank you
you applied two different versions of google play services
compile 'com.google.android.gms:play-services:11.4.0'
and
implementation 'com.google.android.gms:play-services-auth:15.0.1'
please unify the API version to be latest version 15.0.1
also it is recommended to use latest version of Firebase Cloud Services APIs
you could check it here
Related
Please can you help me to solve this problem, I don't know where is the problem I have all the updates
The problem:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0, 27.0.2. Examples include
com.android.support:animated-vector-drawable:28.0.0 and
com.android.support:customtabs:27.0.2 less... (Ctrl+F1) Inspection
info: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). Issue id: GradleCompatible
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.el.sohaib.babysitter"
minSdkVersion 22
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
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'
//the erreur implementation 'com.android.support:design:28.0.0'
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.el.sohaib.babysitter"
minSdkVersion 22
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
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.android.support:design:28.0.0'
}
This warning is shown because the Facebook sdk uses older versions of support libraries. It doesn't goes well this the newer version (28.0.0) that you are using in your project.
The Solution is to exclude all older versions of libraries used in Facebook sdk:
implementation ('com.facebook.android:facebook-android-sdk:[5,6)') {
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'customtabs'
exclude group: 'com.android.support', module: 'support-media-compat'
exclude group: 'com.android.support', module: 'support-v4'
}
Excluding dependencies can causes run-time crashes because the library shall be calling functions in those excluded libraries.
Now you need to provide newer versions of all those libraries in your dependencies
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
Here is my complete build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 19
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
/**
* Providing newer versions of those libs
*/
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
/**
* Excluding older libs
*/
implementation ('com.facebook.android:facebook-android-sdk:[5,6)') {
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'customtabs'
exclude group: 'com.android.support', module: 'support-media-compat'
exclude group: 'com.android.support', module: 'support-v4'
}
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'
}
After updating my android studio and build tool version get this error.I have tried all the solution available for this problem over internet , but not successful
don't know why this is happening ??
Android studio version: 3.1
Gradle version": 4.4
Gradle plugin : 3.1
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
My build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc.abc"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true //Tryed this but not worked
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url 'https://github.com/jitsi/jitsi-maven-repository/raw/master/releases'
}
// maven { url "https://dl.bintray.com/michelelacorte/maven/" }
mavenCentral()
}
configurations {
all*.exclude module: 'support-v4'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:support-fragment:27.1.0'
// multipart entity
implementation('org.apache.httpcomponents:httpmime:4.+') {
exclude module: "httpclient"
}
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
// implementation 'com.wonderkiln:camerakit:0.13.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.jitsi.react:jitsi-meet-sdk:1.9.0'
// compile 'com.google.code.gson:gson:2.2.4'
// compile 'com.android.support:support-emoji:26.0.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.yalantis:ucrop:2.2.0-native'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
implementation 'org.igniterealtime.smack:smack-experimental:4.2.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.2.0'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
// implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
// compile 'it.michelelacorte.swipeablecard:library:2.3.0#aar'{
// exclude module: 'appcompat-v7'
// exclude group: 'com.android.support'
// }
// BUTTER KNIFE
implementation('com.jakewharton:butterknife:8.5.1') {
exclude module: 'appcompat-v7'
exclude group: 'com.android.support'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
// implementation project(':libemoji')
implementation 'com.android.support:support-v13:27.1.0'
}
It's waste almost my 10 days...
most confusing error ever encounter..
This error happens if your code has two different modules of google-play-services or support-v4 which are using different versions of these libraries.
Check the dependencies of the libraries you are using in your project or use
gradle app:dependencies
to see dependency tree of your project and then when you find out which libraries is used with different version, add it to your dependencies with correct version. For example if google-play-services:location:11.2.0 appeared in your dependencies, replace it with google-play-services:location:11.8.0
Usually you will see a warning or error message in your build.gradle file (i.e. one dependency will be marked with red underline showing it cause version mismatch) in such cases.
In my case, project and module's package name is same. When running in debug mode, everything is okey. But when i want to build release mode. I got this error. Renaming package name is the solution for me.
The error is Error
:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. >
java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I have tried all the solutions given on stackoverflow but none of them worked for me.
This is app level gradle file. I think I am using all the latest dependencies.
app level build.gradle file is uploaded here. help me to solve this problem
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId"com.example.pratikrathi.registerapp"
minSdkVersion 20
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled = true
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'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraintlayout:1.0.2'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
compile 'com.google.firebase:firebase-firestore:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
}
apply plugin: 'com.google.gms.google-services'
You are mixing old firebase dependencies with the new firebase dependencies.
You need to remove the following from your root build.gradle dependencies:
classpath 'com.firebase:firebase-client-android:2.3.1'
Then check and remove old firebase depedencies from your module build.gradle. Please read https://firebase.google.com/support/guides/google-android
UPDATE
You also have a duplicated support library.
'com.theartofdev.edmodo:android-image-cropper:2.6.+' library implicitly using support library version 27+, which you can check from its root build.gradle.
You can fix it by exclude support library from image-cropper like this:
implementation ("com.theartofdev.edmodo:android-image-cropper:2.6.+") {
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
}
Or updating all of your support library to version 27.1.0.
I built a normal android app which uses Firebase to store data(name,email and number) and it runs perfectly but i have a dependency conflict error which i am unable to solve. the message which i get "Message Gradle Build" is:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.2.0) and test app (25.4.0) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
and my build.gradle file contains:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.arya.anish.myfirebaseexample"
minSdkVersion 19
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.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
how to overcome this error?
try adding this to your app level .gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
finally figured out how to solve the dependency conflict
i added this line in the build.gradle file in the depndencies block:
compile 'com.android.support:support-annotations:27.0.2'
and bingo, no errors now.
I have been using retrofit2 along with Gson convertor in many applications. But currently I'm contributing to an existing project and i have used both dependencies. While running the project directly, it works perfectly. But whenever I generate a debug or release build, This error appears in Toast and Api content is not parsed.
Proguard is disabled. Here is the error:
No virtual method
newJsonReader(Ljava/io/Reader;)Lcom/google/gson/stream/JsonReader; in
class Lcom/google/gson/Gson; or its super classes (declaration of
'com.google.gson.Gson' appears in
/data/app/com."packagename"/base.apk:classes2.dex)
App Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.medris.medrisemt.medrishcemt"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':zoomsdk')
implementation project(':zoomcommonlib')
implementation project(':redirectionalgorithm');
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'io.jsonwebtoken:jjwt:0.9.0'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'commons-codec:commons-codec:1.9'
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'org.apache.httpcomponents:httpcore:4.4.1'
testImplementation 'junit:junit:4.12'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'com.google.android.gms:play-services:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
I have searched for relevant answers but no satisfactory results. I have tried to downgrade the gson & retrofit dependencies but no success.
Update
I have updated the Gson & retrofit-convertor dependencies in the gradle code above to the one I was actually using initially. I mistakenly posted the downgraded ones that I tried for testing.
Try this,
I started using the newer versions:
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
And the error disappeared.
After adding this dependencies in your gradle file, please clean and
rebuild your project.
write this in build.gradle > these are newer versions
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'