1
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.liew.minnanonihongo"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {

Would the apps able to run with API level 26 while my minSdk versionn is 22?

Liew Syet Chau
  • 143
  • 3
  • 14
  • will work on api level 22, see this: http://www.dummies.com/web-design-development/mobile-apps/the-compile-sdk-minimum-sdk-and-target-sdk-versions/ (you can search for more results on google, there're a lot, like this: https://stackoverflow.com/questions/26694108/what-is-the-difference-between-compilesdkversion-and-targetsdkversion) – AsfK Dec 10 '17 at 07:50
  • So, i just set the compileSdkVersion to 26 while my minSdkversion and targetSdkversion below 26 so that i can run my apps with API26 version? – Liew Syet Chau Dec 10 '17 at 08:02
  • Btw, I got this error when I gave a button on XML file this code: "android:autoSizeTextType="uniform"" I deleted this line, and the error has gone, but this code's workings were good, I'm sorry I have to delete because app might not work at previous Android users. – Bay Oct 18 '20 at 21:38

2 Answers2

1

The short answer:

Yes

The minSdk is 22, meaning you can run it. You still can't use new API's on incompatible versions, but that can easily be handled with a version check in java code, and new tags in XML are simply ignored

Essentially, you can run your app on any version as long as it's above the minSdk. Any new API's you want to jse, however, you have to find replacements for the versions that don't support it. But that's something you have to do either way.

The compile version is simply which version you chose to compile with. If you for an instance compile with API22, you won't be able to get material design. In API24, a new fromHtml method was added and the old was deprecated. It isn't going to show up as deprecated unless you compile with API 24 or higher, assuming it isn't removed in that API

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • can u teach me how to fix the support library parts ? i cannot run the autosizing features in android O, it said the attribute autosizing features only used in API level26. – Liew Syet Chau Dec 10 '17 at 08:29
  • You mean it wasn't added until API 26. If you read [the docs on auto sizing textviews](https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html) it contains a part on the support library – Zoe Dec 10 '17 at 08:32
  • Attribute autoSizeTextType is only used in API level 26 and higher (current min is 22) less... (Ctrl+F1) This check finds attributes set in XML files that were introduced in a version newer than the oldest version targeted by your application (with the minSdkVersion attribute). This is not an error; the application will simply ignore the attribute. – Liew Syet Chau Dec 10 '17 at 08:37
  • what should i use ? – Liew Syet Chau Dec 10 '17 at 09:07
  • Look in the link I gave in an earlier comment. It's all covered there – Zoe Dec 10 '17 at 09:07
  • i looked but i still not really understand about it. – Liew Syet Chau Dec 10 '17 at 09:08
  • It's all covered there. Read it, you'll figure it out. I answered the main question, for any other completely differeny questions like the one you're currently asking, write another question – Zoe Dec 10 '17 at 09:10
0

Yes Because of

minSdkVersion 22
Dipendra Sharma
  • 2,404
  • 2
  • 18
  • 35