Created
December 24, 2015 08:07
-
-
Save Neznakomec/cfb73cc5ba74329d6b2e to your computer and use it in GitHub Desktop.
How i'm finding android:debuggable flag in AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean getDebuggable() { | |
def debuggableFlag = null; | |
def manifest = new XmlSlurper().parse(file("AndroidManifest.xml")) | |
def groovy.util.slurpersupport.NodeChild app; | |
def ns = new groovy.xml.Namespace("http://schemas.android.com/apk/res/android", "android") | |
manifest.children().find { it.name() == "application" }.each { | |
def groovy.util.slurpersupport.NodeChild application = it; | |
def debuggable = application.attributes().get(ns.debuggable.toString()) | |
//println application.attributes().toMapString() | |
if (debuggable == "false") { | |
//return false //return not working | |
debuggableFlag = false; | |
} | |
if (debuggable == "true") { | |
//return true //return not working | |
debuggableFlag = true; | |
} | |
} | |
return debuggableFlag | |
} | |
task test1 { | |
description "find debuggable flag" | |
doFirst { | |
println getDebuggable() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment