Conflict with dependency : build.gradle - java

I added a new dependency
compile 'com.github.markomilos:paginate:0.5.1'
but after synchronization build, I have an error
"Conflict with dependency com.android.support:support-annotations'"
here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.formation.mvpnewproject"
minSdkVersion 17
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.1.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.google.code.gson:gson:2.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
compile 'com.github.markomilos:paginate:0.5.1'
}
a screenshot on the error message
Thank you.

add android test dependency
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
and replace compile with implementation
implementation 'com.github.markomilos:paginate:0.5.1'
because the compile configuration is now deprecated and should be replaced by implementation or api for more info about read this answer

Use this into your build.gradle(app) file as top level.
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
}
like:
apply plugin: 'com.android.application'
android {
.......
.......
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
}
dependencies {
........
.......
}

Related

Gradle sync failed: setup project failed: java.io.EOFException

I add a PrefManager file in my project to check first time login in app.After that I start sync gradle.It show me Gradle sync failed: setup project failed: java.io.EOFException error
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "comviewappisome.google.sites.watchandearn"
minSdkVersion 17
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:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.firebase:firebase-core:16.0.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 project(':luckyWheel')
implementation 'com.google.firebase:firebase-database:16.0.5'
}

How to correctly change MinSDKVersion from 15 to 16 for firebase

I was originally using minSDKVersion 15, but now have to change to 16 because I need to implement firebase. Using the previous version of firebase is not an option.
Simply changing the minSDKVersion to 16 in the build.gradle(Module:app) gives the following error:
Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-40:19 to override.
I did try the suggestion it provides to add 'tools:replace="android:appComponentFactory"' to the element in AndroidManifest.xml but that produces even more errors.
I changed my build.gradle(Module:app) file from this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.comapny.app"
minSdkVersion 15
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 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.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'
implementation 'com.android.volley:volley:1.1.0'
}
to this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.dataletix.gr8"
minSdkVersion 16
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 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.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'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
Any Help will be greatly appreciated. Thank you.
Try to downgrade the firebase dependency from 17.0.0 to 16.0.7
This is the version that I'm currently using and it works.
Be very careful about firebase versions. There are some dependencies that will crash your project if you set the wrong version.
Here is a list of some stable dependencies that I use:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-functions:16.3.0'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.google.firebase:firebase-config:16.3.0'
implementation 'com.google.firebase:firebase-database:16.1.0'

Android Butterknife implementation error saying compile is obsolete and has been replaced with with 'implementation' and 'api'

I have implemented following in in build.app file
//dependency for view implementation
implementation 'com.jakewharton:butterknife:9.0.0-rc2'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
in my project but when i am running the application its giving following error:
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
//code of gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xyc.com"
minSdkVersion 15
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.constraint:constraintlayout: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'
//recyclerview dependency
implementation 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.android.support:cardview-v7:28.0.+'
implementation 'com.google.android.gms:play-services-location:15.0.1'
//dependency for view implementation
implementation 'com.jakewharton:butterknife:9.0.0-rc2'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
}

Build error for gradle in app

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [G:\new\Schat\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Dell.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.0.aar\56bf57c0daa4e0ce1427f0af1690a5ff\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.sushem.schat"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
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:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.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.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.firebaseui:firebase-ui-database:3.2.2'
compile 'id.zelory:compressor:2.1.0'
compile 'com.android.support:multidex:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
Use the last version of support library
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
Thanks everyone for helping.
The problem was with dependacy :
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
So i Removed it.

Android conflict version gradle

im having a problem on my build.gradle which is a version conflict with firebase-auth and the com.google.android.gms.
Error message printscreen
Gradle source
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "pt.tomasdealmeida.sotreta"
minSdkVersion 21
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'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
implementation 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-ads:11.6.2'
}
apply plugin: 'com.google.gms.google-services'
try this
change this
compile 'com.google.android.gms:play-services-ads:11.6.2'
to
compile 'com.google.android.gms:play-services-ads:11.8.0'
and please cek this Release Note
December 18, 2017 - Google Play services 11.8.0 release

Categories

Resources