Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android APK was rejected by Google Play because it's debuggable #2575

Closed
fishy opened this issue Feb 23, 2017 · 6 comments
Closed

Android APK was rejected by Google Play because it's debuggable #2575

fishy opened this issue Feb 23, 2017 · 6 comments
Assignees
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: documentation (cleanup)

Comments

@fishy
Copy link

fishy commented Feb 23, 2017

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

I have an android_binary rule, and generated app_unsigned.apk file from the rule.

Then I signed it with my release key per instructions on #1613, as:

bazel build java:app --strategy=AndroidAapt=standalone
zipalign -v -p 4 bazel-bin/java/app_unsigned.apk app-unsigned-aligned.apk
apksigner sign --ks release.jks --out app.apk app-unsigned-aligned.apk
rm app-unsigned-aligned.apk

When I try to publish the generated app.apk file on Google Play, it was rejected as "You uploaded a debuggable APK".

Bazel should provide a way to generate undebuggable APKs.

If possible, provide a minimal example to reproduce the problem:

Environment info

  • Operating System:
    macOS 10.12.3

  • Bazel version (output of bazel info release):
    release 0.4.4-homebrew

  • If bazel info release returns "development version" or "(@non-git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).

@fishy
Copy link
Author

fishy commented Feb 23, 2017

Adding android:debuggable="false" into the application section in AndroidManifest.xml can workaround this issue, but that means I have to maintain two AndroidManifest.xml files, one for debug and one for release, which is error-prone. Bazel should provide a mechanism to generate release APK.

@iirina iirina added category: rules > android P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: feature request labels Feb 23, 2017
@iirina
Copy link
Contributor

iirina commented Feb 23, 2017

@ahumesky can you take a look please?

@ahumesky
Copy link
Contributor

ahumesky commented Feb 23, 2017

--compilation_mode=opt (or -c opt for short) should set the debuggable flag to false, among other optimizations. We're revamping our android documentation and we'll be sure to mention this.

@fishy
Copy link
Author

fishy commented Feb 23, 2017

--compilation_mode=opt did the trick, but -copt doesn't work:

$ bazel build java:app --strategy=AndroidAapt=standalone -copt
Invalid options syntax: -copt
$ bazel build java:app --strategy=AndroidAapt=standalone --copt
Expected value after --copt

@ahumesky
Copy link
Contributor

whoops, that's a typo, there should be a space between -c and opt ("-c opt") (i edited my comment above)

@fishy
Copy link
Author

fishy commented Feb 23, 2017

-c opt worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: documentation (cleanup)
Projects
None yet
Development

No branches or pull requests

3 participants