Good morning, I just finished an app I was working on. Now I want to improve it by adding recyclerviews to it instead of listviews.
This is my original gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.oftecnica2.appcorporativa"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile "com.google.android.gms:play-services:8.3.0"
}
For this reason, in its gradle I want to add the corresponding libraries, which from what I understand are these:
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
When I add it, this library protests me:
compile 'com.android.support:appcompat-v7:22.2.1'
After trying to compile, I get these errors:
Error:(16, 30) error: package org.apache.http.client does not exist
Error:(17, 38) error: package org.apache.http.client.methods does not exist
Error:(18, 35) error: package org.apache.http.impl.client does not exist
Error:(19, 35) error: package org.apache.http.impl.client does not exist
Error:(118, 13) error: cannot find symbol class DefaultHttpClient
Error:(118, 46) error: cannot find symbol class DefaultHttpClient
Error:(122, 13) error: cannot find symbol class HttpGet
Error:(122, 33) error: cannot find symbol class HttpGet
Error:(135, 17) error: cannot find symbol class ResponseHandler
Error:(135, 61) error: cannot find symbol class BasicResponseHandler
How can I use these libraries and at the same time continue using the project that is already finished?
Thank you
I think the error is because of this:
When in the dependencies that you have added you indicate this for example:
You would need to change the android version:
And I think here too:
Hope this can help you
You must update the android studio sdk.
The problem is that it doesn't find classes that your project requires in this case
org.apache.http.*
which are the ones indicated in the error message:
The Apache classes are not included in the Android SDK for this reason updating is not a solution.
The .jar containing these Apache classes can be downloaded from the Apache Software Foundation
add it
.jar
directly to the folder/libs
and within yourbuild.gradle
enable to support this library:You should stop using the apache connection libraries and use HttpURLConnection .