Elias Naur uploaded a change:
https://go-review.googlesource.com/9802
mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files
The gomobile bind command outputs an .aar file ready to include in an
Android project. If the including project use the minifyEnabled gradle
option the field go.Seq.memptr will be removed since it is only referenced
from C code.
Instruct the minifier to keep all go.* java code by adding an appropriate
proguard.txt file to the .aar file.
Change-Id: Ia1e89a5d8f4b4f349f9c2cf4d0dba2628557fdf9
---
M cmd/gomobile/bind.go
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmd/gomobile/bind.go b/cmd/gomobile/bind.go
index 8804e38..0a2a9a4 100644
--- a/cmd/gomobile/bind.go
+++ b/cmd/gomobile/bind.go
@@ -311,7 +311,7 @@
// R.txt (mandatory)
// res/ (mandatory)
// libs/*.jar (optional, not relevant)
-// proguard.txt (optional, not relevant)
+// proguard.txt (optional)
// lint.jar (optional, not relevant)
// aidl (optional, not relevant)
//
@@ -345,6 +345,12 @@
const manifestFmt = `<manifest
xmlns:android="
http://schemas.android.com/apk/res/android" package=%q />`
fmt.Fprintf(w, manifestFmt, "go."+pkg.Name+".gojni")
+ w, err = aarwcreate("proguard.txt")
+ if err != nil {
+ return err
+ }
+ fmt.Fprintln(w, `-keep class go.** { *; }`)
+
w, err = aarwcreate("classes.jar")
if err != nil {
return err
--
https://go-review.googlesource.com/9802