是否必须使用api 22棒棒糖编译我的应用程序?

时间:2015-04-21 05:37:26

标签: android android-studio gradle compiler-errors

我的项目用api 21编译并运行正常,当我尝试使用api 22编译它时,我面临来自gradle(Error:In <declare-styleable> SherlockSpinner, unable to find attribute android:popupPromptView和许多其他错误)的许多错误,我无法修复它们。

所以问题是如果我让api 22去用api 21编译它,以及哪些设备无法运行我的应用程序会发生什么?

更新

请查看我的配置并告诉我哪些设备无法运行我的应用 这是我的build.gradle配置文件的一部分:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
    }

    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
}
dependencies {
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.google.android.gms:play-services-base:6.5.+'
    compile project(':chipsLibrary')
    compile project(':slidingMenu')
    compile project(':listviewanims')
    compile project(':switchCompatLibrary')
    compile project(':lib_numberpicker')
    compile project(':styleddialogslib')
    compile project(':doomDatePickerlibrary')
    compile project(':swipelistview')
    compile project(':actionbarsherlockPullToRefresh')
    compile project(':showcaseLib_Untouched_library')
    compile project(':cropper')
    compile project(':library_androidanims')
    compile project(':library_async_45')
    compile files('libs/google-api-services-drive-v2-rev123-1.18.0-rc.jar')
    compile files('libs/google-oauth-client-1.18.0-rc.jar')
    compile files('libs/acra-4.5.0.jar')
    // Required for Dropbox
    compile files('libs/dropbox-android-sdk-1.6.1.jar')
    compile files('libs/json_simple-1.1.jar')
    compile files('libs/systembartint-1.0.3.jar')
    compile files('libs/universal-image-loader-1.9.2 (1).jar')
    compile files('libs/volley.jar')
    compile files('libs/google-api-client-1.18.0-rc.jar')
    compile files('libs/google-api-client-android-1.18.0-rc.jar')
    compile files('libs/google-http-client-1.18.0-rc.jar')
    compile files('libs/google-http-client-android-1.18.0-rc.jar')
    compile files('libs/google-http-client-gson-1.18.0-rc.jar')
    compile files('libs/joda-time-2.3.jar')
    compile files('libs/itext-4.2.1.jar')
}

1 个答案:

答案 0 :(得分:0)

只有在您想要使用该特定SDK版本提供的功能时,才需要通过定义特定的编译SDK版本来编译您的应用程序。

您绝对可以使用较低版本进行编译,并使其与较高版本兼容,但如上所述,您无法使用更高版本定义的新功能/功能。