@@ -179,8 +179,9 @@ android {
179179 }
180180 }
181181 }
182- lintOptions {
183- abortOnError false
182+ lint {
183+ abortOnError = false
184+ checkReleaseBuilds = false
184185 }
185186
186187 publishing {
@@ -220,30 +221,37 @@ android {
220221 }
221222 }
222223
223- packagingOptions {
224- excludes = [
225- " **/libc++_shared.so" ,
226- " **/libfbjni.so" ,
227- " **/libjsi.so" ,
228- " **/libreact_nativemodule_core.so" ,
229- " **/libreactnativejni.so" ,
230- " **/libruntimeexecutor.so" ,
231- " **/libturbomodulejsijni.so" ,
232- " **/libreactnative.so" ,
233- " META-INF/**"
234- ]
224+ packaging {
225+ jniLibs {
226+ excludes + = [
227+ " **/libc++_shared.so" ,
228+ " **/libfbjni.so" ,
229+ " **/libjsi.so" ,
230+ " **/libreact_nativemodule_core.so" ,
231+ " **/libreactnativejni.so" ,
232+ " **/libruntimeexecutor.so" ,
233+ " **/libturbomodulejsijni.so" ,
234+ " **/libreactnative.so" ,
235+ ]
236+ }
237+ resources {
238+ excludes + = [" META-INF/**" ]
239+ }
235240 }
236241
237242 if (ENABLE_PREFAB ) {
243+ // Ensure the headers directory exists at configuration time for AGP validation
244+ file(" ${ project.buildDir} /headers/ReactNativeBabylon" ). mkdirs()
245+
238246 buildFeatures {
239247 prefab true
240248 prefabPublishing true
241249 }
242- /* prefab {
250+ prefab {
243251 ReactNativeBabylon {
244252 headers " ${ project.buildDir} /headers/ReactNativeBabylon/"
245253 }
246- }*/
254+ }
247255 }
248256
249257 // Create new configurations that can be referred to in dependencies.
@@ -363,6 +371,10 @@ if (ENABLE_PREFAB) {
363371 }
364372 it. path = path
365373 }
374+ // Ensure the output directory exists even when no headers are found
375+ doFirst {
376+ file(" ${ project.buildDir} /headers/ReactNativeBabylon" ). mkdirs()
377+ }
366378 }
367379 preBuild. dependsOn(prepareHeaders)
368380}
@@ -387,4 +399,20 @@ configurations.extractLibs.files.each { file ->
387399afterEvaluate {
388400 nativeBuildDependsOn(extractAARHeaders, null )
389401 nativeBuildDependsOn(extractJNIFiles, null )
402+
403+ // Workaround for Kotlin 2.0.x / AGP 8.8.x lint incompatibility (KT-62555)
404+ try {
405+ def attrClass = Class . forName(
406+ " org.jetbrains.kotlin.gradle.targets.native.toolchain.KotlinNativeBundleArtifactFormat\$ KotlinNativeBundleArtifactsTypes"
407+ )
408+ def attr = Attribute . of(" kotlin.native.bundle.type" , attrClass)
409+ def regularValue = attrClass. enumConstants. find { it. name() == " REGULAR" } ?: attrClass. enumConstants[0 ]
410+ configurations. configureEach { config ->
411+ if (! config. attributes. contains(attr)) {
412+ config. attributes. attribute(attr, regularValue)
413+ }
414+ }
415+ } catch (Exception e) {
416+ logger. warn(" Kotlin native bundle type workaround skipped: ${ e.message} " )
417+ }
390418}
0 commit comments