I've been using this code to remove a permission i dont want from Manifest file, however with the new Merger this is not possible anymore and i don′t have the knowledge with gradle to modify it.
applicationVariants.all { variant ->
variant.processManifest.doLast {
println("configuring AndroidManifest.xml removing READ_CALL_LOG");
def manifestFile = new File("${buildDir}/intermediates/manifests/${variant.dirName}/AndroidManifest.xml")
def content = manifestFile.getText()
def updatedContent = content.replaceAll("<android:uses-permission android:name="android.permission.READ_CALL_LOG" />", "")
manifestFile.write(updatedContent)
}
variant.processResources.manifestFile = new File("${buildDir}/intermediates/manifests/${variant.dirName}/AndroidManifest.xml")
}
I tried something like this but it's not working
applicationVariants.all { variant ->
variant.outputs.each { output ->
def manifestOutFile = output.processManifest.manifestOutputFile
def newFileContents = manifestOutFile.getText('UTF-8').replace("<android:uses-permission android:name="android.permission.READ_CALL_LOG" />", "")
manifestOutFile.write(newFileContents, 'UTF-8')
}
}
How can i achieve the same with the new Merger ?
Thansk in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…