While rebuilding my project i encountered this warning
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
here is my gradle.build in which i have tried adding the stated solutions in given link but the problem still persists.So what should i do?
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
// tried this but no help
// useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
resConfigs "en_US", "hi_IN"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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'
})
//tried this but no help
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:gridlayout-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
testCompile 'junit:junit:4.12'
Question reffered for solution
EDIT: the issue is about something else
Add the dependency like this:
android {
useLibrary 'org.apache.http.legacy'
}
From here: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client
Problem solved after removing this dependency completely from my project
compile 'io.kickflip:sdk:1.3.1'
and also from my libs dir.
Related
I am new to android studio and am trying to add Google sheets api v4. On their website it says to add some dependencies to my build.gradle file.
Here is what my gradle currently looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
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 {
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.google.android.gms:play-services-location:11.0.4'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
The error occurs when I try to add the following lines
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev483-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
When I try to sync my Gradle I instead get this error:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Any help fixing this would be appreciated as I am pretty new to android studio.
In your build.gradle (in app folder) add the following inside android{} body
android {
....
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
Related answer: https://stackoverflow.com/a/37357786/8405762
I am using org.apache.http.entity.mime.MultipartEntityBuilder to upload images to the server, When I tested in version 7 devices, its works fine but in devices 4.x it throughs error like java.lang.NoClassDefFoundError at runtime. I am not sure where those classes went missing at runtime for 4.x devices.I am using Android Studio 2.3.3.I hope I have messed up Gradle hence the same works fine in 4.x devices when I use the same in a different application.
Build Gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.xx.xx.xx"
minSdkVersion 16
targetSdkVersion 23
versionCode 32
versionName "4.0.2"
multiDexEnabled true
}
lintOptions{
disable 'MissingTranslation'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
}
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.firebase:firebase-messaging:9.2.1'
compile 'com.google.firebase:firebase-crash:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.google.android.exoplayer:exoplayer-core:r2.4.1'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
}
apply plugin: 'com.google.gms.google-services'
Gradle wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
I am working with Firebase in my Android project. When I add
apply plugin: 'com.google.gms.google-services'
in gradle, it gives me an error. logcat says:
Error:Execution failed for task ':app:mergeDebugResources'.
> [string/google_api_key] E:\android\Workspace\FireGuard\app\src\main\res\values\strings.xml [string/google_api_key] E:\android\Workspace\FireGuard\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
I searched a lot, but no luck. How to remove this error? Please help.
below is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.pc.fireguard"
minSdkVersion 16
targetSdkVersion 24
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'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:support-v13:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile project(':date4j')
compile project(':simple-crop-image-lib')
compile 'com.squareup.picasso:picasso:2.3.2'
compile project(':httpclient-4.3.4')
compile project(':httpmime-4.3.4')
compile project(':httpcore-4.3.2')
compile 'com.paypal.sdk:paypal-android-sdk:2.15.1'
}
apply plugin: 'com.google.gms.google-services'
Strings.xml in your app is having same name as of values.xml of google services library!
Since this answer has helped you in sorting out the issue, I am posting the same comment as an answer.
I'm using Firebase UI in my app but having difficulty building the app after adding the Firebase UI dependency. It complains about
'com/google/android/gms/auth/api/signin/internal/zzf.class' being duplicated, so I added an exclude statement for it but without success. Here is how my build.gradle look like:
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "appfactory.app.chatapp"
minSdkVersion 16
targetSdkVersion 24
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/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'com/google/android/gms/auth/api/signin/internal/zzf.class'
}
}
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'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:0.6.2'
}
apply plugin: 'com.google.gms.google-services'
And here is the error I get
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
From the readme file of FirebaseUI for Android — UI Bindings for Firebase
Each version of FirebaseUI has dependency on a fixed version of these
libraries, defined as the variable firebase_version in
common/constants.gradle
In your case you are using 0.6.2 and the corresponding com.google.firebase:firebase version is 9.8.0
So changing
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
to
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
Should fix the problem.
Please see following attached screen shot. I will try to add android-v4 jar file but getting issue in android stdio (in Android stdio, Adding by import project feature)
When importing jar file den got following error.
build.gradle (Module::App) file is here
android {
compileSdkVersion 13
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.jigsaw.startup"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.android.support:support-v4:21.0.3'alert
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
Let me know if anybody need any extra information.
This statement in your build script:
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
is explicitly excluding anything from com.android.support.v4 from being linked into your project, so that's why the import com.android.support.v4.Fragment statement isn't working. Remove that and the import should be fine.
I changed android API and worked on Andoid 4.2. then issue resolved.
Thanks to all