Skip to content

Conversation

@equescodebelike
Copy link

from flutter 3.29 and AGP using, you can automatically add namespaces for example using that script:

fun Project.configureAndroidProject(android: Any) {
    android.javaClass.getMethod("setCompileSdkVersion", Int::class.java)
        .invoke(android, TARGET_COMPILE_SDK_VERSION)

    if (android.javaClass.getMethod("getNamespace").invoke(android) == null) {
        android.javaClass.getMethod("setNamespace", String::class.java)
            .invoke(android, project.group.toString())
    }

    val compileOptions = android.javaClass.getMethod("getCompileOptions").invoke(android)
    compileOptions.javaClass.getMethod("setSourceCompatibility", JavaVersion::class.java)
        .invoke(compileOptions, TARGET_JVM_VERSION)
    compileOptions.javaClass.getMethod("setTargetCompatibility", JavaVersion::class.java)
        .invoke(compileOptions, TARGET_JVM_VERSION)
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant