<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shubham Nagar on Medium]]></title>
        <description><![CDATA[Stories by Shubham Nagar on Medium]]></description>
        <link>https://medium.com/@shubham_nagar?source=rss-03b981105de9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Shubham Nagar on Medium</title>
            <link>https://medium.com/@shubham_nagar?source=rss-03b981105de9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:46:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shubham_nagar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What’s the Difference Between minSdk, targetSdk, and compileSdk?]]></title>
            <link>https://medium.com/@shubham_nagar/whats-the-difference-between-minsdk-targetsdk-and-compilesdk-15a64d25878e?source=rss-03b981105de9------2</link>
            <guid isPermaLink="false">https://medium.com/p/15a64d25878e</guid>
            <category><![CDATA[android-interviews]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android-sdk]]></category>
            <dc:creator><![CDATA[Shubham Nagar]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 11:33:59 GMT</pubDate>
            <atom:updated>2026-08-17T11:33:59.301Z</atom:updated>
            <content:encoded><![CDATA[<p><em>minSdk, targetSdk, compileSdk — here’s how each one actually works.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVwfb91F3TmjqPTfrI-YhA.png" /></figure><p>These three settings appear in every Android project, yet they’re one of the most common points of confusion for developers. They look almost identical, but each controls something completely different — and getting them wrong leads to crashes, unexpected behavior, and rejected Play Store uploads. Let’s clear it up once and for all.</p><pre>android {<br>    compileSdk = 35<br>    defaultConfig {<br>        minSdk = 24<br>        targetSdk = 35<br>    }<br>}</pre><p>They look the same. They are not. Here’s each one in a single sentence:</p><ul><li><strong>minSdk</strong> — the <em>oldest</em> Android version your app runs on.</li><li><strong>targetSdk</strong> — the Android version your app is <em>tested and built for</em>.</li><li><strong>compileSdk</strong> — the Android version your code is <em>compiled with</em>.</li></ul><p>And one rule ties them together:</p><pre>minSdk  ≤  targetSdk  ≤  compileSdk</pre><p>Let’s make each one click.</p><h3>minSdk — “How old a phone can install my app?”</h3><p>If you set minSdk = 24 (Android 7.0), a phone on Android 6.0 can&#39;t install your app. Simple as that.</p><p>It also decides which APIs are safe to call directly. Example: notification channels only exist from API 26. So on a minSdk 24 app, this crashes on older phones:</p><pre>// NotificationChannel needs API 26<br>val channel = NotificationChannel(id, name, importance) // crashes on API 24/25</pre><p>Fix: wrap it in a version check, or raise your minSdk.</p><p><strong>Lower minSdk = more users, more compatibility code. Higher minSdk = cleaner code, fewer users.</strong></p><h3>compileSdk — “Which APIs can my code see?”</h3><p>compileSdk decides what your code is <em>allowed to reference</em> while building. It does <strong>not</strong> change how the app behaves when it runs.</p><p>Example: the POST_NOTIFICATIONS permission was added in API 33. To even write this line, your compileSdk must be 33 or higher:</p><pre>val perm = Manifest.permission.POST_NOTIFICATIONS // needs compileSdk &gt;= 33</pre><p>Below 33, it won’t compile — the name doesn’t exist yet.</p><p><strong>Rule of thumb: always set compileSdk to the latest stable version.</strong></p><h3>targetSdk — “Which new Android rules do I follow?”</h3><p>Every Android version adds new rules (permissions, background limits, etc.). The system only applies the newer rules if your targetSdk is high enough. It&#39;s basically a promise: <em>&quot;I tested my app for this version, apply its rules to me.&quot;</em></p><p>Example: runtime permissions arrived in API 23. With targetSdk = 22, the system uses old behavior and grants permissions at install. Bump to 23+ and now you must ask at runtime:</p><pre>// Enforced only when targetSdk &gt;= 23<br>if (checkSelfPermission(CAMERA) != GRANTED) {<br>    requestPermissions(arrayOf(CAMERA), CODE)<br>}</pre><p>Same phone — different behavior, just from targetSdk.</p><p><strong>Note:</strong> Google Play requires a fairly recent targetSdk, so you can’t leave it low forever.</p><h3>The easiest way to remember it</h3><p>Think of building a house:</p><ul><li><strong>compileSdk</strong> = the tools in your workshop. Newer workshop, more tools.</li><li><strong>minSdk</strong> = the oldest neighborhood you’ll deliver the house to.</li><li><strong>targetSdk</strong> = the building code you promise to follow.</li></ul><h3>Quick recap</h3><p><strong>minSdk</strong> — Oldest phone I support? Set it as low as you reasonably can.</p><p><strong>compileSdk</strong> — Which APIs can I reference? Use the latest stable version.</p><p><strong>targetSdk</strong> — Which new OS rules do I follow? Use the latest stable version.</p><p>Three settings, three jobs. Get them right and your app installs widely, behaves correctly on new phones, and passes Play Store review.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15a64d25878e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>