Gradle process manifest with new Manifest Merger

前端 未结 2 1268
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 18:49

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 wit

相关标签:
2条回答
  • 2020-12-19 19:21

    To answer my own question i ended up solving the problem by setting the TargeSdkVersion in gradle file to a higher version than 15, that's why Android was adding the Read Call Log permission. This way there's no need to process the manifest and remove it by hand.

    0 讨论(0)
  • 2020-12-19 19:30
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
               output.processManifest.doLast{
                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')
            }
       }
    }
    

    This could help you easily.

    0 讨论(0)
提交回复
热议问题