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

On Android, if your app is called x.y.switch, it fails to build #460

Closed
paulproteus opened this issue Jul 26, 2020 · 4 comments
Closed

On Android, if your app is called x.y.switch, it fails to build #460

paulproteus opened this issue Jul 26, 2020 · 4 comments
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@paulproteus
Copy link
Contributor

Describe the bug

If you call your app switch (or another Java reserved word), you will be unable to build it on Android.

To Reproduce

You can reproduce by creating an app whose module_name is switch. For example, you can use a Toga demo app.

Steps to reproduce the behavior:

  1. Download the toga source code, then cd into examples/switch
  2. Run briefcase create android && briefcase build android
  3. Wait for the build to complete (about 60 seconds if you've used Briefcase on this system to make Android apps)
  4. See an error:
> Task :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Package 'org.beeware.switch' from AndroidManifest.xml is not a valid Java package name as 'switch' is a Java keyword.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
15 actionable tasks: 15 executed

Error while building project.

Expected behavior

The app should build or briefcase should print an error at the briefcase new phase, or briefcase should print an error before trying to run briefcase create android.

Environment:

  • Operating System: macOS 10.15
  • Python version: 3.7
  • Software versions:
    • Briefcase: 0.3.3
    • Toga: current git (0.3.0pre21)

Additional context
Add any other context about the problem here.

@paulproteus paulproteus added the bug A crash or error in behavior. label Jul 26, 2020
@freakboy3742 freakboy3742 added good first issue Is this your first time contributing? This could be a good place to start! up-for-grabs labels Jul 26, 2020
@freakboy3742
Copy link
Member

Agreed that this is an edge case we need to catch - probably very early in the process.

App names will also be restricted by Python reserved words - you couldn't name your app "def" or "import" for example.

We also need to validate the parts of the bundle ID - org.switch.goodname will also be a problem on Android.

@junefish
Copy link

junefish commented Oct 2, 2020

Hello! I would like to try fixing this.

@freakboy3742
Copy link
Member

@junefish By all means - go ahead! If you need any pointers or suggestions, let us know!

@KabirAcharya
Copy link

KabirAcharya commented Feb 14, 2021

Made a fork to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

No branches or pull requests

4 participants