diff --git a/app/internal/testapp/AndroidManifest.xml b/app/internal/testapp/AndroidManifest.xml
index 3d8213e..824d880 100644
--- a/app/internal/testapp/AndroidManifest.xml
+++ b/app/internal/testapp/AndroidManifest.xml
@@ -10,7 +10,7 @@ license that can be found in the LICENSE file.
android:versionCode="1"
android:versionName="1.0">
-
+
diff --git a/bind/java/seq_test.go b/bind/java/seq_test.go
index 9ce0672..646ec46 100644
--- a/bind/java/seq_test.go
+++ b/bind/java/seq_test.go
@@ -141,7 +141,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 'android-19'
buildToolsVersion '21.1.2'
- defaultConfig { minSdkVersion 14 }
+ defaultConfig { minSdkVersion 15 }
}
repositories {
diff --git a/cmd/gomobile/binary_xml.go b/cmd/gomobile/binary_xml.go
index aa77048..e8b620a 100644
--- a/cmd/gomobile/binary_xml.go
+++ b/cmd/gomobile/binary_xml.go
@@ -86,6 +86,35 @@ func binaryXML(r io.Reader) ([]byte, error) {
}
switch tok := tok.(type) {
case xml.StartElement:
+ // uses-sdk is synthesized by the writer, disallow declaration in manifest.
+ if tok.Name.Local == "uses-sdk" {
+ return nil, fmt.Errorf("unsupported manifest tag ")
+ } else if tok.Name.Local == "application" {
+ // synthesize before handling token
+ attr := xml.Attr{
+ Name: xml.Name{
+ Space: "http://schemas.android.com/apk/res/android",
+ Local: "minSdkVersion",
+ },
+ Value: "15",
+ }
+ ba, err := pool.getAttr(attr)
+ if err != nil {
+ return nil, fmt.Errorf("failed to synthesize attr minSdkVersion=\"15\"")
+ }
+ elements = append(elements,
+ &binStartElement{
+ line: line - 1, // current testing strategy is not friendly to synthesized tags, -1 for would-be location
+ ns: pool.getNS(""),
+ name: pool.get("uses-sdk"),
+ attr: []*binAttr{ba},
+ },
+ &binEndElement{
+ line: line - 1,
+ ns: pool.getNS(""),
+ name: pool.get("uses-sdk"),
+ })
+ }
// Intercept namespace definitions.
var attr []*binAttr
for _, a := range tok.Attr {
diff --git a/cmd/gomobile/binary_xml_test.go b/cmd/gomobile/binary_xml_test.go
index 1cc4990..0a04d69 100644
--- a/cmd/gomobile/binary_xml_test.go
+++ b/cmd/gomobile/binary_xml_test.go
@@ -8,6 +8,7 @@ import (
"archive/zip"
"bytes"
"flag"
+ "fmt"
"io/ioutil"
"log"
"os"
@@ -27,7 +28,7 @@ func TestBinaryXML(t *testing.T) {
sortPool, sortAttr = sortToMatchTest, sortAttrToMatchTest
defer func() { sortPool, sortAttr = origSortPool, origSortAttr }()
- bin, err := binaryXML(bytes.NewBufferString(input))
+ bin, err := binaryXML(bytes.NewBufferString(fmt.Sprintf(input, "")))
if err != nil {
t.Fatal(err)
}
@@ -77,7 +78,8 @@ func TestBinaryXML(t *testing.T) {
}
manifest := filepath.Join(tmpdir, "AndroidManifest.xml")
- if err := ioutil.WriteFile(manifest, []byte(input), 0755); err != nil {
+ inp := fmt.Sprintf(input, "")
+ if err := ioutil.WriteFile(manifest, []byte(inp), 0755); err != nil {
t.Fatal(err)
}
@@ -807,7 +809,7 @@ license that can be found in the LICENSE file.
android:versionCode="1"
android:versionName="1.0">
-
+ %s
-
-
+
-
-