@@ -32,11 +32,13 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
3232import org.gradle.api.Plugin
3333import org.gradle.api.Project
3434import org.gradle.api.artifacts.Configuration
35+ import org.gradle.api.file.FileCollection
3536import org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication
3637import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
3738import org.gradle.kotlin.dsl.support.unzipTo
3839import org.gradle.kotlin.dsl.support.zipTo
3940import java.io.File
41+ import kotlin.reflect.full.functions
4042
4143/* *
4244 * Adds grease configurations for bundling dependencies in AAR files.
@@ -239,7 +241,15 @@ open class GreasePlugin : Plugin<Project> {
239241 }
240242 }
241243
242- val files = projectNativeLibs.get().files().files + localJarsNativeLibs?.files.orEmpty()
244+ // In agp 8.8.0 return type of `localJarsNativeLibs` property was changed
245+ // So its starts to throw `NoSuchMethodError` when we applied older version of agp
246+ // To prevent that we simply find this function by reflection, call it
247+ // and casting result to proper type
248+ fun LibraryJniLibsTask.localJarsNativeLibs () = this ::class .functions
249+ .find { it.name == " localJarsNativeLibs" }
250+ ?.let { it.call() as ? FileCollection }
251+
252+ val files = projectNativeLibs.get().files().files + localJarsNativeLibs()?.files.orEmpty()
243253 if (files.isNotEmpty()) {
244254 doLast { injectJniLibs() }
245255 } else {
0 commit comments