Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix NotSuchMethodError with agp 8.8.0
  • Loading branch information
FlatSpike committed Feb 17, 2025
commit 514ae8c637688fcd9c4cab3f6153a0a3feddab36
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.1.4"
agp = "8.8.1"
apache-ant = "1.10.14"
asm-commons = "9.6"
android-tools = "31.1.4"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
12 changes: 11 additions & 1 deletion grease/src/main/kotlin/io/deepmedia/tools/grease/GreasePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileCollection
import org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.kotlin.dsl.support.unzipTo
import org.gradle.kotlin.dsl.support.zipTo
import java.io.File
import kotlin.reflect.full.functions

/**
* Adds grease configurations for bundling dependencies in AAR files.
Expand Down Expand Up @@ -239,7 +241,15 @@ open class GreasePlugin : Plugin<Project> {
}
}

val files = projectNativeLibs.get().files().files + localJarsNativeLibs?.files.orEmpty()
// In agp 8.8.0 return type of `localJarsNativeLibs` property was changed
// So its starts to throw `NoSuchMethodError` when we applied older version of agp
// To prevent that we simply find this function by reflection, call it
// and casting result to proper type
fun LibraryJniLibsTask.localJarsNativeLibs() = this::class.functions
.find { it.name == "localJarsNativeLibs" }
?.let { it.call() as? FileCollection }

val files = projectNativeLibs.get().files().files + localJarsNativeLibs()?.files.orEmpty()
if (files.isNotEmpty()) {
doLast { injectJniLibs() }
} else {
Expand Down