How to put my libraries in front of android.jar by editing build.gradle.kts in Android-Studio

It’s fine to adjust the dependency order of framework.jar and android.jar using build.gradle, but it doesn’t work with build.gradle.kts. Are there any solutions?

Similar issue has been solved,but it can’t work by editing build.gradle.kts:
Setting JAR priority in Android Application plugin.

How did you “solve” it in Groovy DSL and why shouldn’t it work in Kotlin DSL? What works in one should also work in the other if properly translated.

Sorry for the unclear saying. I mean the same method works fine in build.gradle (Groovy DSL), but fails in build.gradle.kts (Kotlin DSL). I’m currently using AGP 8.x, and I suspect it’s not just a Kotlin DSL (kts) issue.

Why unclear? I already got that from the original question, thus my question you didn’t answer.

The linked thread has maybe snippets, some are in Groovy DSL, some are in Kotlin DSL, and all are a bad idea. :smiley: