llm, continue editing AGENTS based on findings when fixing more Android projects.
This commit is contained in:
1 parent
482d3072f5
commit
d15b22ec26
1 file changed
+117
-45
@@ -650,57 +650,129 @@
|
|||||||
|
|
||||||
## Android / Flutter
|
## Android / Flutter
|
||||||
|
|
||||||
Android : paths are from the project root.
|
- Gradle 9.8.2
|
||||||
Flutter : paths are under the folder `android`.
|
- AGP 9.5.0
|
||||||
|
- Kotlin 2.4.21
|
||||||
- gradle/wrapper/grade-wrapper.properties
|
- Java JDK 17
|
||||||
- Gradle 9.8.2
|
- Flutter Plugin Loader 1.0.0
|
||||||
```
|
- compileSdk 37
|
||||||
...
|
- targetSDK 37
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
|
|
||||||
```
|
|
||||||
- settings.gradle.kts
|
|
||||||
- AGP 9.5.0, Kotlin 2.4.21, Flutter Plugin Loader 1.0.0
|
|
||||||
```
|
|
||||||
id("com.android.application") version "9.5.0" apply false
|
|
||||||
id("org.jetbrains.kotlin.android") version "2.4.21" apply false
|
|
||||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
|
||||||
```
|
|
||||||
- app/build.gradle.kts
|
|
||||||
- Java JDK 17
|
|
||||||
```
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
// AGP 9's bundled Kotlin - use the native DSL
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
jvmTarget.set(JvmTarget.JVM_17)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
- Also enable minify and shrink while in there.
|
|
||||||
```
|
|
||||||
buildTypes {
|
|
||||||
getByName("release") {
|
|
||||||
...
|
|
||||||
isMinifyEnabled = true
|
|
||||||
isShrinkResources = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Regardless of whether AGP bundles Kotlin, we need to specify it to
|
Regardless of whether AGP bundles Kotlin, we need to specify it to
|
||||||
avoid things like "Your project's Kotlin version (2.2.10) is lower
|
avoid things like "Your project's Kotlin version (2.2.10) is lower
|
||||||
than Flutter's minimum supported version of 2.2.20. Please upgrade
|
than Flutter's minimum supported version of 2.2.20. Please upgrade
|
||||||
your Kotlin version." This is exactly why we use these versions,
|
your Kotlin version." This is exactly why we use these versions,
|
||||||
plus it helps document what's actually being used over guessing.
|
plus it helps document what's actually being used over guessing.
|
||||||
|
|
||||||
|
Android : paths are from the project root.
|
||||||
|
Flutter : paths are under the folder `android`.
|
||||||
|
|
||||||
|
### All Android Project Types
|
||||||
|
|
||||||
|
#### ./gradle/wrapper/grade-wrapper.properties
|
||||||
|
|
||||||
|
```
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ./settings.gradle.kts
|
||||||
|
|
||||||
|
```
|
||||||
|
id("com.android.application") version "9.5.0" apply false
|
||||||
|
id("org.jetbrains.kotlin.android") version "2.4.21" apply false
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ./app/build.gradle.kts
|
||||||
|
|
||||||
|
```
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_17)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Also enable minify and shrink while in there.
|
||||||
|
|
||||||
|
```
|
||||||
|
buildTypes {
|
||||||
|
getByName("release") {
|
||||||
|
...
|
||||||
|
isMinifyEnabled = true
|
||||||
|
isShrinkResources = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Flutter Projects
|
||||||
|
|
||||||
|
#### ./settings.gradle.kts
|
||||||
|
|
||||||
|
```
|
||||||
|
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Native Kotlin Apps
|
||||||
|
|
||||||
|
These only apply to Android apps which are not Flutter, Kivy, etc.
|
||||||
|
|
||||||
|
#### Plugin Versions
|
||||||
|
|
||||||
|
##### ./gradle/libs.versions.toml
|
||||||
|
|
||||||
|
```
|
||||||
|
[versions]
|
||||||
|
agp = "9.5.0"
|
||||||
|
kotlin = "2.4.21"
|
||||||
|
coreKtx = "1.19.1"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.3.0"
|
||||||
|
espressoCore = "3.7.0"
|
||||||
|
lifecycleRuntimeKtx = "2.11.0"
|
||||||
|
activityCompose = "1.13.0"
|
||||||
|
composeBom = "2026.09.00"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Kotlin Compose Fix
|
||||||
|
|
||||||
|
Also ensure Kotlin is coming from Compose and not Jetbrains.
|
||||||
|
|
||||||
|
##### ./gradle/libs.versions.toml
|
||||||
|
|
||||||
|
```
|
||||||
|
[plugins]
|
||||||
|
androidApplication = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
#jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
|
```
|
||||||
|
|
||||||
|
##### ./build.gradle.kts
|
||||||
|
|
||||||
|
```
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.androidApplication) apply false
|
||||||
|
//alias(libs.plugins.jetbrainsKotlinAndroid) apply false
|
||||||
|
alias(libs.plugins.kotlinCompose) apply false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### ./app/build.gradle.kts
|
||||||
|
|
||||||
|
```
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.androidApplication)
|
||||||
|
//alias(libs.plugins.jetbrainsKotlinAndroid)
|
||||||
|
alias(libs.plugins.kotlinCompose)
|
||||||
|
}
|
||||||
|
```
|
||||||
backup: false
|
backup: false
|
||||||
owner: "{{ user }}"
|
owner: "{{ user }}"
|
||||||
group: "{{ user }}"
|
group: "{{ user }}"
|
||||||
|
|||||||
Reference in new issue
Block a user