question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android gradle build fails for application

See original GitHub issue

I was trying to build a simple dummy app using toga and packaging it with briefcase for different platforms. The simple app opens a blank window (source code below)

import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class Freedom(toga.App):
    def startup(self):
        # Create a main window with a name matching the app
        self.main_window = toga.MainWindow(self.name)

        # Create a main content box
        main_box = toga.Box()

        # Add the content on the main window
        self.main_window.content = main_box

        # Show the main window
        self.main_window.show()

def main():
    return Freedom('Freedom', 'com.example.freedom')

The build succeeds for macOS and linux platforms and runs fine on these platforms (i didn’t try others yet) but fails for android. I am working on Mac OS Sierra with python 3.6, toga.version 0.3.0.dev8 , briefcase.version 0.2.1 To setup the development environment for android I installed Android Studio (v 3.0.1) downloaded sdk 15 and 25. I set up the ANDROID_HOME environment and PATH variables as described in https://media.readthedocs.org/pdf/briefcase/latest/briefcase.pdf (page 14, android section)

Running python setup.py android successfully creates the android folder with the output

Installing collected packages: freedom
  Running setup.py install for freedom ... done
Successfully installed freedom-0.0.1
 * No icons defined - using default...
 * No splash screen defined...

Installation complete.

To compile, install and run the project on your phone:

    $ cd android
    $ ./gradlew run

The error occurs when using gradlew. If I run gradlew build or gradlew run, the process ends with the error message

Problem occurred in toga/handlers.py
Node: YieldFrom(value=Call(func=Attribute(value=Name(id='asyncio', ctx=Load(), lineno=19, col_offset=23), attr='sleep', ctx=Load(), lineno=19, col_offset=23), args=[
    Name(id='delay', ctx=Load(), lineno=19, col_offset=37),
  ], keywords=[], lineno=19, col_offset=23), lineno=19, col_offset=12)
:buildPythonDebug FAILED

FAILURE: Build failed with an exception.

* Where:
Build file 'freedom/android/build.gradle' line: 15

* What went wrong:
Execution failed for task ':buildPythonDebug'.
> Process 'command 'voc'' finished with non-zero exit value 1

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

BUILD FAILED

Total time: 16.915 secs

Any idea what might be going wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
nmilosevcommented, Apr 16, 2018

I can also confirm that the combination of Toga 0.2.15 and VOC 0.1.4 works great. thanks @donkirkby

1reaction
donkirkbycommented, Apr 15, 2018

OK, I found the problem. It looks like there’s a bug in VOC 0.1.5. Rolling back to 0.1.4 fixed it for me.

pipenv install voc==0.1.4

I’ll report a bug on the VOC project and link it back here, so I think you can close this one. Thanks for helping me track it down.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to build project with Android studio - Stack Overflow
6 Answers 6 · File->Other Settings->Default Project Structure · Under Project Settings: Project, set Project SDK as Android SDK. · Click Edit button...
Read more >
Different Ways to fix "Error running android: Gradle project ...
Different Ways to fix “Error running android: Gradle project sync failed” in Android Studio ; Method 1: Restarting your project using Invalidate ...
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix the issue for the current project, click Run > Edit Configurations and change the default JUnit configuration to only include the...
Read more >
Why does a build fail in Android Studio even if I don't ... - Quora
There are several causes for gradle build fail in Android studio. Few reasons might be: * Dependencies added * Importing the project from...
Read more >
Troubleshooting builds - Gradle User Manual
If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found