在Android Api 23

时间:2016-04-07 15:40:41

标签: java android gradle android-permissions support-v4

我将com.android.support:support-v4升级到23.2.1,因为从Android 6.0我们需要在运行时检查并请求权限。 升级后,所有这些错误消息都会出现

  

错误:(48,31)错误:包android.support.v4.view不存在   android.support.v4.view.PagerAdapter不存在。

所以当我将旧的android支持jar文件添加回我的项目libs文件夹时,

  

无法解析ActivityCompat.requestPermissions。

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

我尝试了几种解决方案但仍无法正常工作。是否有任何解决方法可以支持所有解决方案?

这是我的gradle文件。

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"
    }
}

0 个答案:

没有答案