meazuri
meazuri

Reputation: 93

Using deprecated classes in Android Api 23

I upgraded my com.android.support:support-v4 to 23.2.1 because from Android 6.0 we need to check for and request permissions at runtime. After I upgraded ,all these error message come up

Error:(48, 31) error: package android.support.v4.view does not exist android.support.v4.view.PagerAdapter does not exist.

So When I added back old android support jar file to my project libs folder ,

ActivityCompat.requestPermissions cannot be resolved .

compile files('libs/android-support-v4.jar')

I tried several solutions and still not working.Is there any workaround to be able to support all?

Here is my gradle file.

apply plugin: 'com.android.application'
android {

    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    useLibrary  'org.apache.http.legacy'
    defaultConfig {
        applicationId ""
        minSdkVersion 15
        targetSdkVersion 23
        multiDexEnabled true
        versionCode 117
        versionName 'P.5.53.4'
    }

    signingConfigs {
        release {
            storeFile file("something.keystore")
            storePassword "1234"
            keyAlias "something"
            keyPassword "1234"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

    lintOptions {

        // set to true to turn off analysis progress reporting by lint
        quiet true
        // if true, stop the gradle build if errors are found
        abortOnError false
        // if true, only report errors
        ignoreWarnings true

    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/ASL2.0'
    }
    configurations {
        all*.exclude module: 'servlet-api'
        all*.exclude group: 'com.google.gson', module: 'gson'
    }
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'

    }

    buildTypes {
        release {
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    repositories{
        mavenCentral()
    }


}

dependencies {


    compile files('libs/aspectjrt.jar')
    compile files('libs/CWAC-SackOfViewsAdapter.jar')
    compile files('libs/httpclient-4.3.3.jar')
    compile files('libs/httpcore-4.3.2.jar')
    compile files('libs/httpmime-4.3.3.jar')
    compile files('libs/jackson-core-asl-1.6.2.jar')
    compile files('libs/jackson-mapper-asl-1.6.2.jar')
    compile files('libs/universal-image-loader-1.9.1.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile project(':volley')

    compile project(':lib')
    compile 'com.google.android.gms:play-services:4.3.23'
    compile 'com.newrelic.agent.android:android-agent:5.5.0'
    compile 'com.google.zxing:core:3.2.1'
    compile 'com.opencsv:opencsv:3.7'

    compile "com.android.support:support-v4:23.2.1"
    compile "com.android.support:support-v13:23.1.0"
    compile "com.android.support:cardview-v7:23.1.0"
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    //compile files('libs/android-support-v4.jar')
}
allprojects {
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:deprecation"
    }
}

Upvotes: 0

Views: 508

Answers (0)

Related Questions