My APK files which I build with Buildozer do not work

908 views
Skip to first unread message

Hiroaki Kaneko

unread,
Apr 6, 2015, 12:02:32 AM4/6/15
to kivy-...@googlegroups.com
Hello,

I built APK file from a simple py code with Buildozer to test it.
I was able to install  it in my android device safely.
When it boot, the player is displayed , but a mp4 file does not start.
The original main.py file and MP4 file work well using KIVY LAUNCHER installed in my same device.
Why?

May be , I think that the path of the MP4 file is wrong.
Please investigate my py code for building APK file.

My android device is ODOROID-XU3 lite.
AndroidOS version is "4.4.2" .
My development enviroment is Ubuntu14.04LTS 64bit.
 
My py code is the following.
-------------------------
import kivy
kivy.require('1.2.0')

from sys import argv
from os.path import dirname, join
from kivy.app import App
from kivy.uix.videoplayer import VideoPlayer

class VideoPlayerApp(App):

    def build(self):
        if len(argv) > 1:
            filename = argv[1]
        else:
            curdir = dirname(__file__)
            filename = join(curdir, '.../storage/sdcard0/myappfiles/test_1080p.mp4')
        return VideoPlayer(source=filename, state='play')


if __name__ == '__main__':
    VideoPlayerApp().run()
-------------------------

Ronaldo Maia

unread,
Apr 6, 2015, 7:51:09 AM4/6/15
to kivy-...@googlegroups.com
The filename you are creating seems a bit strange.

You are joining the current directory with a path that looks like
should be absolute ('/storage/sdcard0...')

Also, I have never seen the use of '...' (3 dots) in paths. One dot
means the current directory, 2 dots mean the parent directory.
> --
> You received this message because you are subscribed to the Google Groups
> "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Ronaldo Maia
Async Open Source

hiro.kaneko

unread,
Apr 7, 2015, 10:52:06 PM4/7/15
to kivy-...@googlegroups.com, rom...@async.com.br
Thank you for your post.

The APK file was installed in /date/app-lib/org.test.myapp .
At first, I tried the absolute pass /storage/sdcard0/myappfiles/test_1080p.mp4.
However,not work.
Next, I tried the relational pass .../storage/sdcard0/myappfiles/test_1080p.mp4.
Again, not wrok.

What is a mistake?

2015年4月6日月曜日 20時51分09秒 UTC+9 Ronaldo Maia:

Hiroaki Kaneko

unread,
Apr 8, 2015, 3:51:38 AM4/8/15
to kivy-...@googlegroups.com, rom...@async.com.br
I tried the code below
----------------------
import kivy
kivy.require('1.2.0')

from sys import argv
from kivy.app import App
from kivy.uix.videoplayer import VideoPlayer

class VideoPlayerApp(App):

    def build(self):
        if len(argv) > 1:
            filename = argv[1]
        else:
            filename = '/storage/sdcard0/myappfiles/test_1080p.mp4'
        return VideoPlayer(source=filename, state='play')

if __name__ == '__main__':
    VideoPlayerApp().run()
----------------------------------------

However, do not work.

Please tell me a solution.


niavlys

unread,
Apr 8, 2015, 4:44:12 AM4/8/15
to kivy-...@googlegroups.com, rom...@async.com.br

filename = 'test_1080p.mp4'
should just work?


filename = join(dirname(__file__),'test_1080p.mp4')

should work too;

3rd option, import kivy.ressources, which is basically a wrapper around the latter solution.

Hiroaki Kaneko

unread,
Apr 9, 2015, 2:33:46 AM4/9/15
to kivy-...@googlegroups.com, rom...@async.com.br
Thank you for your advice!

I tried the following.
-----
class VideoPlayerApp(App):

    def build(self):
        if len(argv) > 1:
            filename = argv[1]
        else:
            curdir = dirname(__file__)
            filename = join(curdir, 'test.mp4')
        return VideoPlayer(source=filename, state='play')
-------------------
However can not work......
I place "main.py" and "test.mp4" in same directory "Kivy_test1".
Then, I built APK file with Buildozer.

I think that I must not build test.mp4 together, must put test.mp4(it is a file to play back) in the directory"sdcard0" in case of Android.

In this case, how should I write the path of "test.mp4" by Python.

2015年4月8日水曜日 17時44分12秒 UTC+9 niavlys:

niavlys

unread,
Apr 9, 2015, 4:25:15 AM4/9/15
to kivy-...@googlegroups.com, rom...@async.com.br
just thinking of another possible issue: by default, buildozer.spec states:

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

have you add mp4 extension to this list?

in case you haven't, your video file won't be bundled into the apk...

hiro.kaneko

unread,
Apr 13, 2015, 3:47:01 AM4/13/15
to kivy-...@googlegroups.com, rom...@async.com.br
I apologize for the delay in replying.

Yes, this line was comment out.

My spec file the following.
------
[app]

# (str) Title of your application
title = videoplayer

# (str) Package name
package.name = player

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
#source.include_exts = py,png,jpg,kv,atlas

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
#version.regex = __version__ = ['"](.*)['"]
#version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
version = 0.9.0

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, portrait or all)
orientation = landscape

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1


#
# Android specific
#

# (list) Permissions
#android.permissions = INTERNET

# (int) Android API to use
android.api = 19

# (int) Minimum API required (8 = Android 2.2 devices)
android.minapi = 8

# (int) Android SDK version to use
android.sdk = 24

# (str) Android NDK version to use
android.ndk = 10d

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/hiroaki_kaneko/Android/android-ndk-r10d

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path = /home/hiroaki_kaneko/Android/Sdk

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
android.p4a_dir  = /home/hiroaki_kaneko/Android/python-for-android

# (list) python-for-android whitelist
#android.p4a_whitelist =

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

#
# iOS specific
#

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1


#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#


#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug
------------------


2015年4月9日木曜日 17時25分15秒 UTC+9 niavlys:

niavlys

unread,
Apr 13, 2015, 5:46:26 AM4/13/15
to kivy-...@googlegroups.com, rom...@async.com.br


Le lundi 13 avril 2015 09:47:01 UTC+2, hiro.kaneko a écrit :


# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy


you have to add ffmpeg as requirement.

hiro.kaneko

unread,
Apr 14, 2015, 12:08:23 AM4/14/15
to kivy-...@googlegroups.com, rom...@async.com.br
It is fine!!
The APK file worked well !
I could resolve the trouble.
Thank you!

Thank for the support of you and all forum members.

2015年4月13日月曜日 18時46分26秒 UTC+9 niavlys:
Reply all
Reply to author
Forward
0 new messages