2

I have built my android application with the following build.gradle details:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}

When I tried to change the compileSdkVersion, I got several errors:

Error:(41, 5) No resource found that matches the given name: attr 'android:borderlessButtonStyle'.
Error:(41, 5) No resource found that matches the given name: attr 'android:buttonBarStyle'.
Error:(41, 5) No resource found that matches the given name: attr 'android:windowCloseOnTouchOutside'.
Error:(46, 5) No resource found that matches the given name: attr 'android:borderlessButtonStyle'.
Error:(46, 5) No resource found that matches the given name: attr 'android:buttonBarStyle'.
Error:(46, 5) No resource found that matches the given name: attr 'android:windowCloseOnTouchOutside'.
Error:(57, 5) No resource found that matches the given name: attr 'android:actionModeCopyDrawable'.
Error:(57, 5) No resource found that matches the given name: attr 'android:actionModeCutDrawable'.
Error:(57, 5) No resource found that matches the given name: attr 'android:actionModePasteDrawable'.
Error:(57, 5) No resource found that matches the given name: attr 'android:buttonBarButtonStyle'.
Error:(57, 5) No resource found that matches the given name: attr 'android:buttonBarStyle'.
Error:(57, 5) No resource found that matches the given name: attr 'android:textColorAlertDialogListItem'.
Error:(57, 5) No resource found that matches the given name: attr 'android:textColorHighlightInverse'.
Error:(57, 5) No resource found that matches the given name: attr 'android:textColorLinkInverse'.
Error:(57, 5) No resource found that matches the given name: attr 'android:windowActionBar'.
Error:(108, 5) No resource found that matches the given name: attr 'android:actionModeCopyDrawable'.
Error:(108, 5) No resource found that matches the given name: attr 'android:actionModeCutDrawable'.
Error:(108, 5) No resource found that matches the given name: attr 'android:actionModePasteDrawable'.
Error:(108, 5) No resource found that matches the given name: attr 'android:buttonBarButtonStyle'.
Error:(108, 5) No resource found that matches the given name: attr 'android:buttonBarStyle'.
Error:(108, 5) No resource found that matches the given name: attr 'android:textColorAlertDialogListItem'.
Error:(108, 5) No resource found that matches the given name: attr 'android:textColorHighlightInverse'.
Error:(108, 5) No resource found that matches the given name: attr 'android:textColorLinkInverse'.
Error:(108, 5) No resource found that matches the given name: attr 'android:windowActionBar'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

I have gone through some links but still have some doubts:

What I am concerned about is whether this app is going to work well on all the sdk versions between 8-23 if I am compiling it with sdk version 23.

Besides, is it possible and advisable to change compileSdkVersion to 8 and will it change the app's performance in any way to do so?

Any suggestions is highly appreciated.

Community
  • 1
  • 1

2 Answers2

1

compileSdkVersion is the version of the API you use for compiling, so you can use all included API features. Also, you can use APIs from previous versions. You can find more details on the internet, for example, here: Picking your compileSdkVersion

It says:

It is strongly recommended that you always compile with the latest SDK. You’ll get all the benefits of new compilation checks on existing code, avoid newly deprecated APIs, and be ready to use new APIs.

vanste25
  • 1,664
  • 14
  • 38
0

Yes, the application will run on lower SDKs as long as you do not use any class that was introduced in the later versions. For example, you can see that Fragment class was introduced in API level 11, so it would crash if you used it on a device with API level 8.

You can use AppCompat libraries for backwards compatible versions of newer features. The support library has a Fragment class that is compatible till API level 1 (not sure).

Compiling with the latest SDKs is advisable and advantageous as it has the optimizations for the newer platforms.

Anuj
  • 1,659
  • 1
  • 10
  • 19