aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src/com/android/ant/SetupTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'anttasks/src/com/android/ant/SetupTask.java')
-rw-r--r--anttasks/src/com/android/ant/SetupTask.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/anttasks/src/com/android/ant/SetupTask.java b/anttasks/src/com/android/ant/SetupTask.java
index f13cccd..72f5d11 100644
--- a/anttasks/src/com/android/ant/SetupTask.java
+++ b/anttasks/src/com/android/ant/SetupTask.java
@@ -264,8 +264,23 @@ public final class SetupTask extends ImportTask {
XPath xPath = AndroidXPathFactory.newXPath();
+ // check the package name.
String value = xPath.evaluate(
"/" + AndroidManifest.NODE_MANIFEST +
+ "/@" + AndroidManifest.ATTRIBUTE_PACKAGE,
+ new InputSource(new FileInputStream(manifest)));
+ if (value != null) { // aapt will complain if it's missing.
+ // only need to check that the package has 2 segments
+ if (value.indexOf('.') == -1) {
+ throw new BuildException(String.format(
+ "Application package '%1$s' must have a minimum of 2 segments.",
+ value));
+ }
+ }
+
+ // check the minSdkVersion value
+ value = xPath.evaluate(
+ "/" + AndroidManifest.NODE_MANIFEST +
"/" + AndroidManifest.NODE_USES_SDK +
"/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX + ":" +
AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,