Is it mandatory to compile my app with api 22 loll

2019-08-13 15:07发布

问题:

My project compiles and runs fine with api 21 and when i try to compile it with api 22 i'm facing many errors from gradle (Error:In <declare-styleable> SherlockSpinner, unable to find attribute android:popupPromptView, and many other errors) and i can't fix them.

So the question is what happens if i let api 22 go and just compile it with api 21, and which devices can't run my app?

UPDATE:

Please take a look at my config and tell me which devices can't run my app this is a part of my build.gradle config file:

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:

Compiling your application by defining particular compile SDK version is only required if you would want to use the features provided by that particular SDK version.

You can definitely compile with lower version and make it compatible for the higher version, but as said above you won't be able to use the new functionalities/features defined by higher version.