Incompatibility in the Android gradle

1

Good morning, I just finished an app I was working on. Now I want to improve it by adding recyclerviews 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 that reason in its gradle I want to add the corresponding libraries, that for what I have understood 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'

By adding it, I protest this library:

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 those libraries and still use the project that is already finished?

Thanks

    
asked by Sergio Cv 23.06.2016 в 09:39
source

3 answers

1

The problem is that you can not find classes that your project requires in this case org.apache.http.*

which are those indicated in the error message:

error: package org.apache.http.client does not exist
error: package org.apache.http.client.methods does not exist
error: package org.apache.http.impl.client does not exist
error: package org.apache.http.impl.client does not exist

The Apache classes are not included in the Android SDK, so updating is not a solution.

The .jar that contains these Apache classes can be downloaded from Apache Software Foundation

add the .jar directly to the folder /libs and within your build.gradle you can support this library:

android {
        useLibrary 'org.apache.http.legacy'
    }

You should stop using the apache libraries for connection and use HttpURLConnection .

    
answered by 23.06.2016 / 16:56
source
1

I think the error is because of this:

compile 'com.android.support:appcompat-v7:22.2.1'

When in the dependencies that you have added, you indicate this, for example:

 compile 'com.android.support:palette-v7:23.1.1'

You need to change the android version:

compile 'com.android.support:appcompat-v7:23.1.1'

And I think here too:

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

I hope it serves you

    
answered by 23.06.2016 в 09:44
1

You must update the android studio sdk.

compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
    
answered by 23.06.2016 в 09:56