LoginSignup
0
0

AGP8系にアップデート時にパッケージにnamespaceがない場合

Posted at

回避策

android/build.gradle
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    afterEvaluate {
        // check if android block is available
        if (it.hasProperty('android')) {

            if (it.android.namespace == null) {
                def manifest = new XmlSlurper().parse(file(it.android.sourceSets.main.manifest.srcFile))
                def packageName = manifest.@package.text()
                println("Setting ${packageName} as android namespace")
                android.namespace = packageName
            }

            def javaVersion = JavaVersion.VERSION_17
            android {
                def androidApiVersion = 34
                compileSdkVersion androidApiVersion
                defaultConfig {
                    targetSdkVersion 33
                }
                compileOptions {
                    sourceCompatibility javaVersion
                    targetCompatibility javaVersion
                }
                tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
                    kotlinOptions {
                        jvmTarget = javaVersion.toString()
                    }
                }
            }
        }

    }
}

解説

  • パッケージのアップデートが追いついていないのでgradle側からnamespaceをつけてあげる(らしい)

github(issue)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0