Get Your Literacy rate Higher with this Android Article.

Get Your Literacy rate Higher with this Android Article.

  • What does API Level mean?
  • How to use compileSdkVersion, minSdkVersion or targetSdkVersion?

This is the must question should be asked by clients to company.

Introduction:

I always guide my android team to follow below link for latest updates on Android:

https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels

There are 4 types of SDK Version:

minSdkVersion

Wonder why some apps are not on search result of Play store apps?

Then Read now below about MinSDK and impact:

It cannot be installed in any normal way on a system with lower API level, this includes command line via adb, manual installation via system UI (installation from unknown source), installation from IDE or gradle scripts and Google Play Store. In the last case app won’t be even shown in search results in Play Store app. In opened app page in store, installation option will be unavailable.

maxSdkVersion

maxSdkVersion which usage not recommended is a partial opposite of minSdkVersion. Using this attribute is almost always not needed since Android API is (almost always) backwards compatible. If this attribute is not defined there is no maximum API level restriction.

targetSdkVersion

It is meaningful only when API level at runtime is higher than targetSdkVersion, in such case some additional compatibility behaviors can be turned on. One of the the drastic example which every other android developer know was introducing JS Interface annotation in API level 17. Starting from it annotation is mandatory and non annotated methods will not work. Developers working before API level 17 was released could not know about that, so apps targeting API level lower than 17 will work without that annotation even on systems with higher API levels. If value is not defined then it will default to minSdkVersion. Recommended way is to set it to the highest API on which app has been tested.

compileSdkVersion

compileSdkVersion is the API level which app is compiled against. Its value determines which APIs can be used in app code (using APIs introduced in higher API levels will cause a compilation error). App can run on device with lower API level if code execution paths do not attempt to invoke any unavailable APIs (except constant which will be simply copied into an app). Value should be always set to the highest stable API level, even if app does not use any API from it. This is due to the fact that some API may be deprecated, stop working – invoked method may start doing nothing like WebView.htmlonChildViewAdded(android.view.View, android.view.View), callbacks may stop being called like WebChromeClient#onJsTimeout(). In such cases compiler warning is raised. Only API levels of installed SDK platforms can be used as a values.

From source code to an APK file

Generally, an Android project is composed by the code developers write using Android API (the application module), plus some other libraries/dependencies (.jar, AAR, local modules…etc) and some resources. 

The compilation process converts Java/Kotlin code, dependencies include into DEX byte-code and then compressed everything into an APK file along with some resources. At this stage, the implementation of the API is not included in the resulting APK!

Keep in mind it is highly recommended to compile against the latest API Level and try to have targetSdkVersion == compileSdkVersion.





要查看或添加评论,请登录

Gaurav Sharma的更多文章

  • Great athletes don’t play for money or glory. They play for a feeling that is something beyond.

    Great athletes don’t play for money or glory. They play for a feeling that is something beyond.

    In my last article, I informed about Team Player character of Rahul Dravid. Interviewer: How do you prepare for a…

  • MY HERO: RAHUL DRAVID: DAY 1

    MY HERO: RAHUL DRAVID: DAY 1

    Good Morning !! Series on My Observation regarding Rahul Dravid. Day 1: ‘You have to become a team player before…

    1 条评论
  • Guru Gobind Singh Ji: Happy Birthday: REAL CEO

    Guru Gobind Singh Ji: Happy Birthday: REAL CEO

    “All progress is born of enquiry. Doubt is often better than over confidence for it leads to enquiry, and enquiry leads…

  • RECAP 2019: HOW MANY DOTS CONNECTED?

    RECAP 2019: HOW MANY DOTS CONNECTED?

    Amazing Year 2019!! Reasons are Many!! Connecting The Dots Existing clients doing Amazing Sales, New clients…

    4 条评论
  • FAST APIS WHICH CONNECT THE DOTS OF YOUR SOFTWARE

    FAST APIS WHICH CONNECT THE DOTS OF YOUR SOFTWARE

    SQL could definitely be considered one of the first APIs. 40 years of database design, implementation, and access has a…

  • Unlocking Product Value with API ERROR Management

    Unlocking Product Value with API ERROR Management

    When CTDWORLD.CO was working with Sikkim Chief Minister for their reputed Mobile Application the most Important thing…

  • API IS SOUL: PART 2

    API IS SOUL: PART 2

    Ecosystems will always win as it's harder to build but easier to change. It’s this flexibility that makes ecosystems so…

  • API IS SOUL: PART 1

    API IS SOUL: PART 1

    "The API should enable developers to do one thing really well. It’s not as easy as it sounds, and you want to be clear…

  • Android Developer

    Android Developer

    Hello All, I had spent 9 years in IT and worked with 44 companies of Fortune 500 and will tell you how fresher learn…

社区洞察

其他会员也浏览了