Code Monkey home page Code Monkey logo

beeware-android-template's Introduction

BeeWare Android Template

A template for starting a native Android app using Python and the BeeWare tools.

More specifically, it uses VOC for compiling Python into Java bytecode and Briefcase to package as an Android app.

Using this template

Requirements: you need to have Python 3, Java JDK and the Android SDK installed

  1. Create a virtualenv using Python 3 (3.5 recommended).
  2. Install cookiecutter. This is a tool used to bootstrap complex project templates:

    $ pip install cookiecutter
  3. Run cookiecutter on this template:

    $ cookiecutter https://github.com/eliasdorneles/beeware-android-template
  4. Add your code to the project.
  5. Install Briefcase. This is a tool that produces a version of your project that can be deployed to specific platforms:

    $ pip install briefcase
  6. Start the Android emulator or connect your Android device
  7. Build and run your app with:

    $ python setup.py android --start

Example apps

  • TicTacToe (created before this template, but using the same building blocks)
  • Drawing app (created with this template)
  • Todo app (created with this template)

beeware-android-template's People

Contributors

eliasdorneles avatar freakboy3742 avatar glasnt avatar jvmaia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

beeware-android-template's Issues

How can I create my own android app with this template?

Thank you for the template. I've tried to find out how it works. But especially the java side does not make much sense to me. I've already read the issue about the documentation. But I don't get it. There are several initial questions.

How can I change the splash screen picture and the time it is shown on the screen?
Where do the "import android" statements in app.py reference to?
Am I able to design my own app with this template without coding java?

Thank you in advance.

android Could not determine the dependencies of task app:mergeDebugNativeLibs

I followed the instructions on https://docs.beeware.org/en/latest/tutorial/tutorial-5/android.html, and when I execute briefcase build android after briefcase create android, I got the following errors.

(beeware-venv) D:\code\python\beeware-tutorial\helloworld>briefcase create android

[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-android-gradle-template.git, branch 3.8
Using existing template (sha 97d59ef36678719a58c487cb2705b3d617f2caec, updated Sat Jun  5 14:12:50 2021)

[helloworld] Installing support package...
Using support package https://briefcase-support.org/python?platform=android&version=3.8
... using most recent revision
Python-3.8-Android-support.b3.zip already downloaded
Unpacking support package...

[helloworld] Installing dependencies...
Collecting toga-android>=0.3.0.dev20
  Using cached toga_android-0.3.0.dev27-py3-none-any.whl (26 kB)
Collecting rubicon-java>=0.2.2
  Using cached rubicon_java-0.2.5-py3-none-any.whl (23 kB)
Collecting toga-core==0.3.0.dev27
  Using cached toga_core-0.3.0.dev27-py3-none-any.whl (487 kB)
Collecting travertino>=0.1.3
  Using cached travertino-0.1.3-py3-none-any.whl (15 kB)
Installing collected packages: travertino, toga-core, rubicon-java, toga-android
Successfully installed rubicon-java-0.2.5 toga-android-0.3.0.dev27 toga-core-0.3.0.dev27 travertino-0.1.3

[helloworld] Installing application code...
Installing src/helloworld...

[helloworld] Installing application resources...
Unable to find 48px round variant for application icon; using default
Unable to find 72px round variant for application icon; using default
Unable to find 96px round variant for application icon; using default
Unable to find 144px round variant for application icon; using default
Unable to find 192px round variant for application icon; using default
Unable to find 48px square variant for application icon; using default
Unable to find 72px square variant for application icon; using default
Unable to find 96px square variant for application icon; using default
Unable to find 144px square variant for application icon; using default
Unable to find 192px square variant for application icon; using default

[helloworld] Created android\gradle\Hello World

(beeware-venv) D:\code\python\beeware-tutorial\helloworld>briefcase build android
[helloworld] Building Android APK...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugNativeLibs'.
> Invalid revision: 3.18.1-g262b901-dirty

* 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 8s

Error while building project.

(beeware-venv) D:\code\python\beeware-tutorial\helloworld>

I even tried to clean the android project, but still got errors.

(beeware-venv) D:\code\python\beeware-tutorial\helloworld\android\gradle\Hello World>gradlew clean
> Task :app:externalNativeBuildCleanDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildCleanDebug'.
> Invalid revision: 3.18.1-g262b901-dirty

* 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 5s
2 actionable tasks: 1 executed, 1 up-to-date

(beeware-venv) D:\code\python\beeware-tutorial\helloworld\android\gradle\Hello World>gradlew assembleDebug

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugNativeLibs'.
> Invalid revision: 3.18.1-g262b901-dirty

* 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 3s

(beeware-venv) D:\code\python\beeware-tutorial\helloworld\android\gradle\Hello World>

I have the updated the latest android sdk.

image

image

Unable to run python setup.py android.

I am following the README.md to the line but when I run python setup.py android I am getting following error.

running android
 * Writing application template...
Template Python-Android-template succesfully updated.
Project template: /home/ratan/.cookiecutters/Python-Android-template
Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    'bundle': 'com.example'
  File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/ratan/.virtualenvs/vocenv/lib64/python3.6/site-packages/briefcase/app.py", line 336, in run
    self.generate_app_template()
  File "/home/ratan/.virtualenvs/vocenv/lib64/python3.6/site-packages/briefcase/app.py", line 195, in generate_app_template
    'secret_key': self.secret_key,
  File "/home/ratan/.virtualenvs/vocenv/lib64/python3.6/site-packages/cookiecutter/main.py", line 63, in cookiecutter
    no_input=no_input,
  File "/home/ratan/.virtualenvs/vocenv/lib64/python3.6/site-packages/cookiecutter/repository.py", line 101, in determine_repo_dir
    '\n'.join(repository_candidates)
cookiecutter.exceptions.RepositoryNotFound: A valid repository for "/home/ratan/.cookiecutters/Python-Android-template" could not be found in the following locations:
/home/ratan/.cookiecutters/Python-Android-template
/home/ratan/.cookiecutters/Python-Android-template

I am using Fedora 26 and python 3.6.

can't run template on windows 10

Hi @eliasdorneles. I am new to cookiecutter and briefcase and followed https://briefcase.readthedocs.io/en/latest/tutorial/tutorial-0.html . I am on Windows 10, and encountered the same issue as reported before.

(BeeEnv) D:\bee_proj>cookiecutter https://github.com/pybee/Python-Android-template
Traceback (most recent call last):
File "d:\anaconda3_5.3.1\envs\beeenv\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "d:\anaconda3_5.3.1\envs\beeenv\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\Anaconda3_5.3.1\envs\BeeEnv\Scripts\cookiecutter.exe_main
.py", line 9, in
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\cookiecutter\cli.py", line 120, in main
password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\cookiecutter\main.py", line 63, in cookiecutter
password=password
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\cookiecutter\repository.py", line 103, in determine_repo_dir
no_input=no_input,
File "d:\anaconda3_5.3.1\envs\beeenv\lib\site-packages\cookiecutter\vcs.py", line 99, in clone
stderr=subprocess.STDOUT,
File "d:\anaconda3_5.3.1\envs\beeenv\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "d:\anaconda3_5.3.1\envs\beeenv\lib\subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/pybee/Python-Android-template']' returned non-zero exit status 128.

how should i solve this ?

invalid command error 'android'

espclient.zip

Hey lads
today I used cookiecutter to make a project with your template and I did anything well but I reached this error while I was trying to build my project
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command android
I think that means something is wrong with requirements but I am fully up to date I'm gonna share version of my packages for you down here:
pip --->pip 19.0.3 from c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages\pip (python 3.6)
setuptools --->Requirement already up-to-date: setuptools in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (40.8.0)
briefcase and other

Requirement already satisfied, skipping upgrade: voc>=0.1.1 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (0.1.6)
Requirement already satisfied, skipping upgrade: urllib3<1.24 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (1.22)
Requirement already satisfied, skipping upgrade: pip>=18.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (19.0.3)
Requirement already satisfied, skipping upgrade: cookiecutter>=1.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (1.6.0)
Requirement already satisfied, skipping upgrade: setuptools>=40.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (40.8.0)
Requirement already satisfied, skipping upgrade: requests<3.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (2.18.4)
Requirement already satisfied, skipping upgrade: boto3>=1.4.4 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from briefcase) (1.9.116)
Requirement already satisfied, skipping upgrade: future>=0.15.2 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (0.17.1)
Requirement already satisfied, skipping upgrade: jinja2-time>=0.1.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (0.2.0)
Requirement already satisfied, skipping upgrade: jinja2>=2.7 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (2.10)
Requirement already satisfied, skipping upgrade: binaryornot>=0.2.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (0.4.4)
Requirement already satisfied, skipping upgrade: whichcraft>=0.4.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (0.5.2)
Requirement already satisfied, skipping upgrade: poyo>=0.1.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (0.4.2)
Requirement already satisfied, skipping upgrade: click>=5.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from cookiecutter>=1.0->briefcase) (7.0)
Requirement already satisfied, skipping upgrade: idna<2.7,>=2.5 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from requests<3.0->briefcase) (2.6)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from requests<3.0->briefcase) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from requests<3.0->briefcase) (2017.11.5)
Requirement already satisfied, skipping upgrade: botocore<1.13.0,>=1.12.116 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from boto3>=1.4.4->briefcase) (1.12.116)
Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from boto3>=1.4.4->briefcase) (0.9.4)
Requirement already satisfied, skipping upgrade: s3transfer<0.3.0,>=0.2.0 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from boto3>=1.4.4->briefcase) (0.2.0)
Requirement already satisfied, skipping upgrade: arrow in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from jinja2-time>=0.1.0->cookiecutter>=1.0->briefcase) (0.13.1)
Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from jinja2>=2.7->cookiecutter>=1.0->briefcase) (1.1.0)
Requirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from botocore<1.13.0,>=1.12.116->boto3>=1.4.4->briefcase) (2.7.5)
Requirement already satisfied, skipping upgrade: docutils>=0.10 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from botocore<1.13.0,>=1.12.116->boto3>=1.4.4->briefcase) (0.14)
Requirement already satisfied, skipping upgrade: six>=1.5 in c:\users\aryan\appdata\local\programs\python\python36\lib\site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.116->boto3>=1.4.4->briefcase) (1.11.0)

I also attached whole project directory.
Thanks for any help,

python for android documentation - read/write files

Thanks for all this work, it is just great! Is there any source or documentation about the python for android, where i could figure out how to use all the import android stuff? I am trying to read a file on android from python but it doesn't work by trial/error. I used the tictactoe examples for widgets and layout understanding but now have hit a road block...

thank you very much

edit: in fact, i will try to read sqlite, so your upcoming todo app looks very promising to me :)))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.