[{"data":1,"prerenderedAt":633},["ShallowReactive",2],{"article-flutter-update28":3},{"article":4,"tags":444,"previous":459,"next":558},{"id":5,"title":6,"author":7,"body":8,"createdAt":433,"description":434,"extension":435,"img":436,"meta":437,"navigation":133,"path":438,"seo":439,"stem":440,"tags":441,"updatedAt":442,"__hash__":443},"articles\u002Farticles\u002Fflutter-update28.md","Flutter Change Android minSdkVersion After Update","[object Object]",{"type":9,"value":10,"toc":431},"minimark",[11,15,26,29,36,42,48,55,65,372,378,424,427],[12,13,14],"p",{},"When creating a flutter app the content of android\\app\\build.gradle is the following.",[16,17,22],"pre",{"className":18,"code":20,"language":21},[19],"language-text","defaultConfig {\n\u002F\u002F TODO: Specify your own unique Application ID (https:\u002F\u002Fdeveloper.android.com\u002Fstudio\u002Fbuild\u002Fapplication-id.html).  \napplicationId \"com.example.app_name\"  \nminSdkVersion flutter.minSdkVersion  \ntargetSdkVersion flutter.targetSdkVersion  \nversionCode flutterVersionCode.toInteger()  \nversionName flutterVersionName\n}  \n","text",[23,24,20],"code",{"__ignoreMap":25},"",[12,27,28],{},"Where do these values come from?",[12,30,31,32,35],{},"flutter.minSdkVersion value is coming from your installed flutter SDK's flutter.gradle file which is located inside ",[23,33,34],{},"your_flutter_sdk\u002Fpackages\u002Fflutter_tools\u002Fgradle\u002Fflutter.gradle","\nRight now Jan 2023 it looks like...",[16,37,40],{"className":38,"code":39,"language":21},[19],"\u002F** Sets the compileSdkVersion used by default in Flutter app projects. *\u002F\nstatic int compileSdkVersion = 31\n\n\u002F** Sets the minSdkVersion used by default in Flutter app projects. *\u002F\nstatic int minSdkVersion = 16\n\n\u002F** Sets the targetSdkVersion used by default in Flutter app projects. *\u002F\nstatic int targetSdkVersion = 31\n\n\u002F**\n * Sets the ndkVersion used by default in Flutter app projects.\n * Chosen as default version of the AGP version below.\n *\u002F\nstatic String ndkVersion = \"21.1.6352462\"\n",[23,41,39],{"__ignoreMap":25},[12,43,44],{},[45,46,47],"strong",{},"Moving forward, how do we change these defaults?",[12,49,50,51,54],{},"With the 2.8 release where the minimum and target SDK versions is set\u002Festablished has changed within the Flutter project.",[52,53],"br",{},"\nHow to change Android minSdkVersion in flutter project?  There are a couple approaches provided below.",[12,56,57,60,61,64],{},[45,58,59],{},"Approach 1."," You can change the minSdkVersion directly in the file Project_Name\u002Fandroid\u002Fapp\u002F",[45,62,63],{},"build.gradle"," , defaultconfig",[16,66,70],{"className":67,"code":68,"language":69,"meta":25,"style":25},"language-flutter shiki shiki-themes github-light github-dark","    defaultConfig {\n    \u002F\u002F TODO: Specify your own unique Application ID (https:\u002F\u002Fdeveloper.android.com\u002Fstudio\u002Fbuild\u002Fapplication-id.html).\n    applicationId \"com.example.projectname\"\n    minSdkVersion 16 \u002F\u002F \u003C--- There\n    targetSdkVersion 27\n    versionCode 1\n    versionName \"1.0\"\n    testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"}\n```\n\n\n\n**Approach 2.** The more appropriate way and maintainable approach is a little more involved however I would recommend.\n\nFor clarity, I will provide what the build.gradle looked like before and after the 2.8 update.\n\n```flutter\n    android {\n        compileSdkVersion 30\n    \n    defaultConfig {\n        applicationId \"com.example.app\"\n        minSdkVersion 21\n        targetSdkVersion 30\n        versionCode flutterVersionCode.toInteger()\n        versionName flutterVersionName\n        multiDexEnabled true\n    }        \n```\n\nAfter updating to Flutter 2.8:\n\n```flutter\n    android {\n        compileSdkVersion flutter.compileSdkVersion\n    \n    defaultConfig {\n            applicationId \"com.example.app\"\n            minSdkVersion flutter.minSdkVersion\n            targetSdkVersion flutter.targetSdkVersion\n            versionCode flutterVersionCode.toInteger()\n            versionName flutterVersionName\n        }\n``` \n\nSo here are the changes so that you can maintain the version(s) within your project.  \n\n**Update the android -> local.properties** adding the following 3 lines.  This will be where you set the min and target versions going forward.\n```flutter\nflutter.minSdkVersion=21\nflutter.targetSdkVersion=30\nflutter.compileSdkVersion=30\n","flutter",[23,71,72,80,86,92,98,104,110,116,122,128,135,140,145,151,156,162,167,173,179,185,191,196,202,208,214,220,226,232,238,243,248,254,259,264,269,275,280,285,291,297,303,309,315,321,327,332,338,343,349,354,360,366],{"__ignoreMap":25},[73,74,77],"span",{"class":75,"line":76},"line",1,[73,78,79],{},"    defaultConfig {\n",[73,81,83],{"class":75,"line":82},2,[73,84,85],{},"    \u002F\u002F TODO: Specify your own unique Application ID (https:\u002F\u002Fdeveloper.android.com\u002Fstudio\u002Fbuild\u002Fapplication-id.html).\n",[73,87,89],{"class":75,"line":88},3,[73,90,91],{},"    applicationId \"com.example.projectname\"\n",[73,93,95],{"class":75,"line":94},4,[73,96,97],{},"    minSdkVersion 16 \u002F\u002F \u003C--- There\n",[73,99,101],{"class":75,"line":100},5,[73,102,103],{},"    targetSdkVersion 27\n",[73,105,107],{"class":75,"line":106},6,[73,108,109],{},"    versionCode 1\n",[73,111,113],{"class":75,"line":112},7,[73,114,115],{},"    versionName \"1.0\"\n",[73,117,119],{"class":75,"line":118},8,[73,120,121],{},"    testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"}\n",[73,123,125],{"class":75,"line":124},9,[73,126,127],{},"```\n",[73,129,131],{"class":75,"line":130},10,[73,132,134],{"emptyLinePlaceholder":133},true,"\n",[73,136,138],{"class":75,"line":137},11,[73,139,134],{"emptyLinePlaceholder":133},[73,141,143],{"class":75,"line":142},12,[73,144,134],{"emptyLinePlaceholder":133},[73,146,148],{"class":75,"line":147},13,[73,149,150],{},"**Approach 2.** The more appropriate way and maintainable approach is a little more involved however I would recommend.\n",[73,152,154],{"class":75,"line":153},14,[73,155,134],{"emptyLinePlaceholder":133},[73,157,159],{"class":75,"line":158},15,[73,160,161],{},"For clarity, I will provide what the build.gradle looked like before and after the 2.8 update.\n",[73,163,165],{"class":75,"line":164},16,[73,166,134],{"emptyLinePlaceholder":133},[73,168,170],{"class":75,"line":169},17,[73,171,172],{},"```flutter\n",[73,174,176],{"class":75,"line":175},18,[73,177,178],{},"    android {\n",[73,180,182],{"class":75,"line":181},19,[73,183,184],{},"        compileSdkVersion 30\n",[73,186,188],{"class":75,"line":187},20,[73,189,190],{},"    \n",[73,192,194],{"class":75,"line":193},21,[73,195,79],{},[73,197,199],{"class":75,"line":198},22,[73,200,201],{},"        applicationId \"com.example.app\"\n",[73,203,205],{"class":75,"line":204},23,[73,206,207],{},"        minSdkVersion 21\n",[73,209,211],{"class":75,"line":210},24,[73,212,213],{},"        targetSdkVersion 30\n",[73,215,217],{"class":75,"line":216},25,[73,218,219],{},"        versionCode flutterVersionCode.toInteger()\n",[73,221,223],{"class":75,"line":222},26,[73,224,225],{},"        versionName flutterVersionName\n",[73,227,229],{"class":75,"line":228},27,[73,230,231],{},"        multiDexEnabled true\n",[73,233,235],{"class":75,"line":234},28,[73,236,237],{},"    }        \n",[73,239,241],{"class":75,"line":240},29,[73,242,127],{},[73,244,246],{"class":75,"line":245},30,[73,247,134],{"emptyLinePlaceholder":133},[73,249,251],{"class":75,"line":250},31,[73,252,253],{},"After updating to Flutter 2.8:\n",[73,255,257],{"class":75,"line":256},32,[73,258,134],{"emptyLinePlaceholder":133},[73,260,262],{"class":75,"line":261},33,[73,263,172],{},[73,265,267],{"class":75,"line":266},34,[73,268,178],{},[73,270,272],{"class":75,"line":271},35,[73,273,274],{},"        compileSdkVersion flutter.compileSdkVersion\n",[73,276,278],{"class":75,"line":277},36,[73,279,190],{},[73,281,283],{"class":75,"line":282},37,[73,284,79],{},[73,286,288],{"class":75,"line":287},38,[73,289,290],{},"            applicationId \"com.example.app\"\n",[73,292,294],{"class":75,"line":293},39,[73,295,296],{},"            minSdkVersion flutter.minSdkVersion\n",[73,298,300],{"class":75,"line":299},40,[73,301,302],{},"            targetSdkVersion flutter.targetSdkVersion\n",[73,304,306],{"class":75,"line":305},41,[73,307,308],{},"            versionCode flutterVersionCode.toInteger()\n",[73,310,312],{"class":75,"line":311},42,[73,313,314],{},"            versionName flutterVersionName\n",[73,316,318],{"class":75,"line":317},43,[73,319,320],{},"        }\n",[73,322,324],{"class":75,"line":323},44,[73,325,326],{},"``` \n",[73,328,330],{"class":75,"line":329},45,[73,331,134],{"emptyLinePlaceholder":133},[73,333,335],{"class":75,"line":334},46,[73,336,337],{},"So here are the changes so that you can maintain the version(s) within your project.  \n",[73,339,341],{"class":75,"line":340},47,[73,342,134],{"emptyLinePlaceholder":133},[73,344,346],{"class":75,"line":345},48,[73,347,348],{},"**Update the android -> local.properties** adding the following 3 lines.  This will be where you set the min and target versions going forward.\n",[73,350,352],{"class":75,"line":351},49,[73,353,172],{},[73,355,357],{"class":75,"line":356},50,[73,358,359],{},"flutter.minSdkVersion=21\n",[73,361,363],{"class":75,"line":362},51,[73,364,365],{},"flutter.targetSdkVersion=30\n",[73,367,369],{"class":75,"line":368},52,[73,370,371],{},"flutter.compileSdkVersion=30\n",[12,373,374,377],{},[45,375,376],{},"Add\u002Fmodify to the android\u002Fsrc\u002Fbuild.gradle"," file",[16,379,381],{"className":67,"code":380,"language":69,"meta":25,"style":25},"    android {\n        compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()\n    ...\n    defaultConfig {\n        minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()\n        targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()\n        versionCode flutterVersionCode.toInteger()\n        versionName flutterVersionName\n    }\n",[23,382,383,387,392,397,401,406,411,415,419],{"__ignoreMap":25},[73,384,385],{"class":75,"line":76},[73,386,178],{},[73,388,389],{"class":75,"line":82},[73,390,391],{},"        compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()\n",[73,393,394],{"class":75,"line":88},[73,395,396],{},"    ...\n",[73,398,399],{"class":75,"line":94},[73,400,79],{},[73,402,403],{"class":75,"line":100},[73,404,405],{},"        minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()\n",[73,407,408],{"class":75,"line":106},[73,409,410],{},"        targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()\n",[73,412,413],{"class":75,"line":112},[73,414,219],{},[73,416,417],{"class":75,"line":118},[73,418,225],{},[73,420,421],{"class":75,"line":124},[73,422,423],{},"    }\n",[12,425,426],{},"Keep in mind with this approach going forward you will maintain minimum and target SDK versions within the local.properties file.",[428,429,430],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":25,"searchDepth":82,"depth":82,"links":432},[],"2022-01-17","With the recent 2.8 release how and where the minSdkVersion is specified has changed.  It took a while to figure out, so I thought I would share this recent tip.","md","\u002Farticles\u002Fimages\u002Fflutter_small.png",{},"\u002Farticles\u002Fflutter-update28",{"title":6,"description":434},"articles\u002Fflutter-update28",[69],"2023-01-01","yIViXfuP1XC3oBwA4eXSe_aiiqi3_lCpBvlr4ZC9lfM",[445],{"id":446,"title":447,"body":448,"description":452,"extension":435,"img":453,"meta":454,"name":69,"navigation":133,"path":455,"seo":456,"stem":457,"__hash__":458},"tags\u002Ftags\u002Fflutter.md","Flutter",{"type":9,"value":449,"toc":450},[],{"title":25,"searchDepth":82,"depth":82,"links":451},[],"Flutter SDK is Google's UI toolkit for crafting beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fflutter",{"description":452},"tags\u002Fflutter","9lY6efG0wl_9qbC_N3ABqlg6pCSWlTRgJqo_PHk8rUM",{"id":460,"title":461,"author":7,"body":462,"createdAt":548,"description":549,"extension":435,"img":550,"meta":551,"navigation":133,"path":552,"seo":553,"stem":554,"tags":555,"updatedAt":548,"__hash__":557},"articles\u002Farticles\u002Fandroid-emulator-playstore.md","How to install Google Play - Android Emulator",{"type":9,"value":463,"toc":546},[464,467],[12,465,466],{},"Working more and more with Android Emulators I am finding not all images have Play Store installed.  The following are 3 easy steps that I have used to get Google Play Store installed and ready upon creation of new emulator.",[468,469,470,509,534],"ol",{},[471,472,473,474,476,480,483,485,486,488,489,491,492,494,495,497,498,500,501,503,506,508],"li",{},"Create Virtual Device.  Here I am selecting Nexus 5 and setting some default parameters that have worked well for me.",[52,475],{},[477,478],"img",{"alt":25,"src":479},"\u002Farticles\u002Fimages\u002Fandroidemulator_playstore1.png",[477,481],{"alt":25,"src":482},"\u002Farticles\u002Fimages\u002Fandroidemulator_playstore2.png",[52,484],{},"Emulated Performance",[52,487],{},"\nGraphics: Hardware - GLES 2.0",[52,490],{},"RAM 4096",[52,493],{},"\nVM Heap 512",[52,496],{},"\nInternal Storage 16024",[52,499],{},"\nStudio Managed 4096",[52,502],{},[477,504],{"alt":25,"src":505},"\u002Farticles\u002Fimages\u002Fandroidemulator_playstore3.png",[52,507],{},"Finish",[471,510,511,514,515,517,520,521,523,525,527,528,530,533],{},[45,512,513],{},"BEFORE"," opening the image do the following.  Open the host directory on the file system.  For me this was C:\\Users\\{username}\\.android\\avd\\Pixel_5_API_30.avd and find the config.ini.  At this point there should be very few files in this directory.  OPEN config.ini",[52,516],{},[45,518,519],{},"Change"," \"PlayStore.enabled=false\" to \"PlayStore.enabled=true\"",[52,522],{},[45,524,519],{},[52,526],{},"\nimage.sysdir.1 = system-images\\android-30\\google_apis\\x86\\",[52,529],{},[45,531,532],{},"TO","\nimage.sysdir.1 = system-images\\android-30\\google_apis_playstore\\x86\\",[471,535,536,537,540,541,543],{},"Return to Android Virtual Device manager and start the image.  At this point, there will be no indication that the Play Store is installed on this device however after starting up it will display correctly.  ",[45,538,539],{},"Start the emulator",".",[52,542],{},[477,544],{"alt":25,"src":545},"\u002Farticles\u002Fimages\u002Fandroidemulator_playstore4.png",{"title":25,"searchDepth":82,"depth":82,"links":547},[],"2022-03-27","When working with Android emulators not all come pre-installed with the PlayStore installed.  The following are steps to enable PlayStore on startup.","\u002Farticles\u002Fimages\u002Fyourvirtualdevices.png",{},"\u002Farticles\u002Fandroid-emulator-playstore",{"title":461,"description":549},"articles\u002Fandroid-emulator-playstore",[556,69],"android","TK1c3u6kKnpGHVSJSDz-765FoWfNMQ8t-QwTaF-h5vQ",{"id":559,"title":560,"author":7,"body":561,"createdAt":625,"description":626,"extension":435,"img":436,"meta":627,"navigation":133,"path":628,"seo":629,"stem":630,"tags":631,"updatedAt":625,"__hash__":632},"articles\u002Farticles\u002Fflutter-tips2.md","Flutter Tips 2",{"type":9,"value":562,"toc":623},[563,566,621],[12,564,565],{},"Tips and Tricks",[468,567,568,582,605,619],{},[471,569,570,571,573,576,578,579,581],{},"Create application icons via online resource for Android and IOS platforms",[52,572],{},[477,574],{"alt":25,"src":575},"\u002Farticles\u002Fimages\u002Fappicongenerator.png",[52,577],{},"android\u002Fapp\u002Fsrc\u002Fmain\u002Fres (copy all midmap)",[52,580],{},"ios\u002Frunner\u002Fassets.xcassets (copy all files to this xcassets from the download from appicongenerator tool)",[471,583,584,585],{},"How can I remove the Flutter debug banner?",[16,586,588],{"className":67,"code":587,"language":69,"meta":25,"style":25},"MaterialApp(\n  debugShowCheckedModeBanner: false,\n) \n",[23,589,590,595,600],{"__ignoreMap":25},[73,591,592],{"class":75,"line":76},[73,593,594],{},"MaterialApp(\n",[73,596,597],{"class":75,"line":82},[73,598,599],{},"  debugShowCheckedModeBanner: false,\n",[73,601,602],{"class":75,"line":88},[73,603,604],{},")\n",[471,606,607,608],{},"Resources",[609,610,611],"ul",{},[471,612,613],{},[614,615,618],"a",{"href":616,"target":617},"https:\u002F\u002Fopenweathermap.org\u002F","_blank","OpenWeather",[471,620],{},[428,622,430],{},{"title":25,"searchDepth":82,"depth":82,"links":624},[],"2021-12-07","Series of tips and tricks related to Flutter mobile platform from Google",{},"\u002Farticles\u002Fflutter-tips2",{"title":560,"description":626},"articles\u002Fflutter-tips2",[69],"Pu3cp_L2QtZXyVxsa0SJsYa1RZNP3Kc1PoNk_f_Oq2o",1781574764258]