devel-jb-kotlin-tooling-agp9-migration
--| | `android.uniquePackageNames` | `false` | `true` | Ensure each library has a unique namespace | | `android.
- License 许可
- MIT
- 最近更新
- 2026-09-01
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- devel-jb-kotlin-tooling-agp9-migration
- domain
- cybersecurity
- description
- --| | `android.uniquePackageNames` | `false` | `true` | Ensure each library has a unique namespace | | `android.
02 资源文件 13
- 资产文件assets/checklist.md3.6 KB
- 资产文件assets/index.json84 B
- 参考文档index.json1.5 KB
- 参考文档references/DSL-REFERENCE.md9.7 KB
- 参考文档references/index.json84 B
- 参考文档references/KNOWN-ISSUES.md18.1 KB
- 参考文档references/MIGRATION-APP-SPLIT.md14.1 KB
- 参考文档references/MIGRATION-FULL-RESTRUCTURE.md12.2 KB
- 参考文档references/MIGRATION-LIBRARY.md12.6 KB
- 参考文档references/PLUGIN-COMPATIBILITY.md2.5 KB
- 参考文档references/VERSION-MATRIX.md6.6 KB
- 脚本scripts/analyze-project.sh8.1 KB
- 脚本scripts/index.json84 B
03 SKILL.md 正文
--|
| android.uniquePackageNames | false | true | Ensure each library has a unique namespace |
| android.enableAppCompileTimeRClass | false | true | Refactor switch on R fields to if/else |
| android.defaults.buildfeatures.resvalues | true | false | Enable resValues = true where needed |
| android.defaults.buildfeatures.shaders | true | false | Enable shaders where needed |
| android.r8.optimizedResourceShrinking | false | true | Review R8 keep rules |
| android.r8.strictFullModeForKeepRules | false | true | Update keep rules to be explicit |
| android.proguard.failOnMissingFiles | false | true | Remove invalid ProGuard file references |
| android.r8.proguardAndroidTxt.disallowed | false | true | Use proguard-android-optimize.txt only |
| android.r8.globalOptionsInConsumerRules.disallowed | false | true | Remove global options from library consumer rules |
| android.sourceset.disallowProvider | false | true | Use Sources API on androidComponents |
| android.sdk.defaultTargetSdkToCompileSdkIfUnset | false | true | Specify targetSdk explicitly |
| android.onlyEnableUnitTestForTheTestedBuildType | false | true | Only if testing non-default build types |
Check for and remove properties that now cause errors:
android.r8.integratedResourceShrinking— removed, always onandroid.enableNewResourceShrinker.preciseShrinking— removed, always on
Pure Android Tips
For non-KMP Android modules upgrading to AGP 9.0:
- Remove
org.jetbrains.kotlin.androidplugin — AGP 9.0 includes Kotlin support built-in (see "Built-in Kotlin Migration" above) - Migrate kapt to KSP or
com.android.legacy-kapt - Migrate
kotlinOptionstokotlin { compilerOptions {} } - Migrate
kotlin.sourceSetstoandroid.sourceSetswith.kotlinaccessor - Review new DSL interfaces —
BaseExtensionis removed; useCommonExtensionor specific extension types - Java default changed from Java 8 to Java 11 — ensure
compileOptionsreflects this - R class is now compile-time non-final in app modules — refactor any
switchstatements on R class fields toif/else - targetSdk defaults to compileSdk if not set — specify
targetSdkexplicitly to avoid surprises - NDK default changed to r28c — specify
ndkVersionexplicitly if using native code - Temporary opt-out:
android.builtInKotlin=false+android.newDsl=falseingradle.properties(removed in AGP 10)
Verification
After migration, verify with the checklist. Key checks:
./gradlew buildsucceeds with no errors./gradlew :androidApp:assembleDebugsucceeds (if app module exists)- No
com.android.libraryorcom.android.applicationin KMP modules - No
org.jetbrains.kotlin.androidin AGP 9.0 modules - Source sets use correct names (
androidMain,androidHostTest,androidDeviceTest) - No deprecation warnings about variant API
- Run configurations point to correct modules
Common Issues
See references/KNOWN-ISSUES.md for details. Key gotchas:
KMP Library Plugin Issues
- BuildConfig unavailable in library modules — use DI/
AppConfigurationinterface, or use BuildKonfig or gradle-buildconfig-plugin for compile-time constants - No build variants — single variant architecture; compile-time constants can use BuildKonfig/gradle-buildconfig-plugin flavors, but variant-specific dependencies/resources/signing must move to app module
- NDK/JNI unsupported in new plugin — extract to separate
com.android.librarymodule - Compose resources crash without
androidResources { enable = true }(CMP-9547) - Consumer ProGuard rules silently dropped if not migrated to
consumerProguardFiles.add(file(...))in new DSL - KSP requires version 2.3.4+ for AGP 9.0 compatibility
AGP 9.0 General Issues
- Built-in Kotlin conflicts —
org.jetbrains.kotlin.androidmust be removed; kapt must be replaced - BaseExtension removed — convention plugins using old DSL types need rewriting
- Variant APIs removed —
applicationVariants,libraryVariants,variantFilterreplaced byandroidComponents - R class non-final —
switchon R fields fails in app modules; refactor toif/else - targetSdk defaults to compileSdk — set explicitly to avoid unexpected behavior changes
- R8 rule changes — strict full mode, no global options in consumer rules
- Plugin compatibility — many plugins need updates or opt-out flags; check Plugin Compatibility section
- Convention plugins need refactoring — old
android {}extension helpers are obsolete
Reference Files
- DSL Reference — side-by-side old→new DSL mapping
- Version Matrix — AGP/Gradle/KGP/IDE compatibility
- Plugin Compatibility — third-party plugin status and workarounds
04 同仓库更多 Skills
services-wmi-persistence-detect
Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.
services-wmi-exec-exploit
Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.
registry-artifact-extract
Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.
processes-token-impersonate-detect
Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.
processes-thread-injection-detect
Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.
processes-hollow-technique-detect
Detect process hollowing (RunPE) by identifying processes with mismatched image paths between PEB and VAD tree, or unmapped PE headers in memory.