Skip to content

Instantly share code, notes, and snippets.

@JEuler
Created September 12, 2025 03:44
Show Gist options
  • Save JEuler/82a9e99cae4c68fd67762cfc23de37a0 to your computer and use it in GitHub Desktop.
Save JEuler/82a9e99cae4c68fd67762cfc23de37a0 to your computer and use it in GitHub Desktop.
Flutter Android 16KB Setup Gist
// app/build.gradle
plugins {
id 'com.android.application'
// Use modern Kotlin Android plugin ID aligned with settings.gradle
id 'org.jetbrains.kotlin.android'
id 'dev.flutter.flutter-gradle-plugin'
}
...
android {
// Use build tools 36.0.0 alongside compileSdk 36
compileSdkVersion 36
buildToolsVersion "36.0.0"
// Updated to NDK r28 (16KB memory pages compatible)
ndkVersion "28.0.12433566"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
// Match Kotlin JVM target to Java 21
jvmTarget = JavaVersion.VERSION_21.toString()
}
...
}
...
buildscript {
// Align Kotlin to 2.1.0 for toolchain consistency with Java 21
ext.kotlin_version = "2.1.0"
repositories {
google()
mavenCentral()
}
dependencies {
// Android Gradle Plugin 8.12.0 for SDK 36 and 16KB page support
classpath "com.android.tools.build:gradle:8.12.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
...
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
# Gradle wrapper bumped for AGP 8.12.x compatibility and Java 21
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
plugins {
// Upgraded for Android 16KB pages + latest SDKs
// AGP 8.12.0, Kotlin 2.1.0 (ensure Flutter Gradle plugin supports these)
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.12.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
}
@laraveloper96
Copy link

// For flutter_local_notifications - enables desugaring in app-build.gradle
coreLibraryDesugaringEnabled true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment