Skip to content

Commit

Permalink
fix: enforce aapt v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Jun 14, 2022
1 parent 8ce3535 commit b68b0bf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ class Patcher(private val options: PatcherOptions) {
if (outDir.exists()) outDir.deleteRecursively()
outDir.mkdirs()

val androlib = Androlib(BuildOptions().also { buildOptions ->
buildOptions.aaptPath = options.aaptPath
buildOptions.frameworkFolderLocation = options.frameworkFolderLocation
})
val androlib = Androlib(BuildOptions().also { it.setBuildOptions(options) })
val resourceTable = androlib.getResTable(extInputFile, true)

val packageMetadata = PackageMetadata()
Expand Down Expand Up @@ -146,8 +143,7 @@ class Patcher(private val options: PatcherOptions) {

val androlibResources = AndrolibResources().also { resources ->
resources.buildOptions = BuildOptions().also { buildOptions ->
buildOptions.aaptPath = options.aaptPath
buildOptions.frameworkFolderLocation = options.frameworkFolderLocation
buildOptions.setBuildOptions(options)
buildOptions.isFramework = metaInfo.isFrameworkApk
buildOptions.resourcesAreCompressed = metaInfo.compressionType
buildOptions.doNotCompress = metaInfo.doNotCompress
Expand Down Expand Up @@ -299,3 +295,9 @@ class Patcher(private val options: PatcherOptions) {
}
}
}

private fun BuildOptions.setBuildOptions(options: PatcherOptions) {
this.aaptPath = options.aaptPath
this.useAapt2 = true
this.frameworkFolderLocation = options.frameworkFolderLocation
}

0 comments on commit b68b0bf

Please sign in to comment.