Use new API for getting the raw Android resources

A new method has been added in the Android Gradle
plugin 3.3.0. This commit switches from ussing the
MergeResources task, and uses getAllRawAndroidResources
API instead.

Test: manually verified
This commit is contained in:
Ivan Gavrilovic
2018-06-20 15:27:47 +01:00
committed by Sergey Igushkin
parent 5dcb02466a
commit 48784fd95e
@@ -96,6 +96,13 @@ class Android25ProjectHandler(kotlinConfigurationTools: KotlinConfigurationTools
variantData.addJavaSourceFoldersToModel(javaSourceDirectory)
override fun getResDirectories(variantData: BaseVariant): List<File> {
val getAllResourcesMethod =
variantData::class.java.methods.firstOrNull { it.name == "getAllRawAndroidResources" }
if (getAllResourcesMethod != null) {
val allResources = getAllResourcesMethod.invoke(variantData) as FileCollection
return allResources.files.toList()
}
return variantData.mergeResources?.computeResourceSetList0() ?: emptyList()
}