cmd/gomobile: fix bugs introduced by cl/17749
These bugs broke the example/audio app
1) Use of wrong index value for nmpkgs.
2) Must not use both armeabi-v7a and armeabi directories in an app.
Only one of them will be scanned.
Change-Id: I0180405e35038db152058961a92c41bc39760a10
Reviewed-on: https://go-review.googlesource.com/17860
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/cmd/gomobile/build_androidapp.go b/cmd/gomobile/build_androidapp.go
index 37efe2b..d22d6af 100644
--- a/cmd/gomobile/build_androidapp.go
+++ b/cmd/gomobile/build_androidapp.go
@@ -54,7 +54,7 @@
}
libFiles := []string{}
- nmpkgs := make(map[string]map[string]bool) // map: goarch -> extractPkgs' output
+ nmpkgs := make(map[string]map[string]bool) // map: arch -> extractPkgs' output
for _, arch := range androidArchs {
env := androidEnv[arch]
@@ -168,13 +168,13 @@
for _, arch := range androidArchs {
toolchain := ndk.Toolchain(arch)
- if nmpkgs[goarch]["golang.org/x/mobile/exp/audio/al"] {
+ if nmpkgs[arch]["golang.org/x/mobile/exp/audio/al"] {
dst := "lib/" + toolchain.arch + "/libopenal.so"
+ src := dst
if arch == "arm" {
- dst = "lib/armeabi/libopenal.so"
+ src = "lib/armeabi/libopenal.so"
}
- src := filepath.Join(ndk.Root(), "openal/"+dst)
- if err := apkwWriteFile(dst, src); err != nil {
+ if err := apkwWriteFile(dst, filepath.Join(ndk.Root(), "openal/"+src)); err != nil {
return nil, err
}
}