Skip to content

Instantly share code, notes, and snippets.

@Neznakomec
Created December 24, 2015 08:07
Show Gist options
  • Save Neznakomec/cfb73cc5ba74329d6b2e to your computer and use it in GitHub Desktop.
Save Neznakomec/cfb73cc5ba74329d6b2e to your computer and use it in GitHub Desktop.
How i'm finding android:debuggable flag in AndroidManifest.xml
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