Innen build.gradle
für Android-ProjektGradle - Wie bekomme ich Werte von AndroidManifest?
task runAndroidApplication(type: Exec, dependsOn: ':installDebug') {
//TODO update Activity name below or find a way to get it from AndroidManifest.xml
if (System.properties['os.name'].toLowerCase().contains('windows')) {
// windows
commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', "com.example.androidapptorun.MainActivity"
} else {
// linux
commandLine 'adb', 'shell', 'am', 'start', '-n', "com.example.androidapptorun.MainActivity"
}
}
Wie Wert für Hauptaktivität von AndroidManifest für die Standard-Aktivität zu bekommen? (auch wenn es mehr Aktivitäten, Logik machen wählen Sie eine lange würde es machen, , während die Verarbeitung innerhalb Android-Tool sein)
Gibt es eine bessere Art und Weise von android-Plugin dann AndroidManifest.xml
Parsen?
UPDATE: https://github.com/novoda/gradle-android-command-plugin Dose möglich Anzug einige Bedürfnisse, aber ich brauchte schnellen Lauf in Eclipse über http://marketplace.eclipse.org/content/gradle
hast du http://stackoverflow.com/questions/10187556/reading-android-manifest-file –
das zu lesen ist ' AndroidManifest.xml "aus der App während der Laufzeit. Die Frage bezieht sich auf Build System Gradle, d. H. Kompilierzeit, keine Android-Klassen. –
Gefunden http://stackoverflow.com/questions/11558157/reading-info-from-existing-pom-xml-file-using-gradle und XmlSluper http://groovy.codehaus.org/Reading+XML+mit+Groovy % 27s + XmlSlurper. Nicht so saubere Lösung .... –