how to add support files to apk?

357 views
Skip to first unread message

Bill Eaton

unread,
Apr 7, 2014, 12:48:29 AM4/7/14
to kivy-...@googlegroups.com
I can't find any information on the structure of apk files or AndroidManifest.xml. I want to add some files to my apk (a font and a sqlite3 db). Is there a guide to doing this that I've missed?

Ben Rousch

unread,
Apr 7, 2014, 7:07:15 AM4/7/14
to kivy-...@googlegroups.com

Put your font at or below the level of your main.py and refer to it with a relative path (like you would an image). Sqlite can be used the same way, or look at user_data_dir at the bottom of http://kivy.org/docs/api-kivy.app.html

On Apr 7, 2014 12:48 AM, "Bill Eaton" <wpea...@gmail.com> wrote:
I can't find any information on the structure of apk files or AndroidManifest.xml. I want to add some files to my apk (a font and a sqlite3 db). Is there a guide to doing this that I've missed?

--
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.

Bill Eaton

unread,
Apr 7, 2014, 7:54:01 PM4/7/14
to kivy-...@googlegroups.com

> Put your font at or below the level of your main.py and refer to it with a relative path (like you would an image)...

I think I've done that. Should I be able to see the file inside the apk somewhere? Or do I add the support files manually?

Ben Rousch

unread,
Apr 7, 2014, 7:57:09 PM4/7/14
to kivy-...@googlegroups.com
You also need to add ttf to line 16 in your buildozer.spec
--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Bill Eaton

unread,
Apr 8, 2014, 12:25:59 AM4/8/14
to kivy-...@googlegroups.com
> ... You also need to add ttf to line 16 in your buildozer.spec ....

Well, I wasn't using buildozer. But I gave it a try anyway. I'm using the Test Drive vm. I changed line 16 to add ttf and db. And I think I added the correct SDK NDK and p4a directories. 

But every time I try to run 
buildozer android update

I get the following messages
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
# Command failed: git clean -dxf

The thing is, if I switch to the p4a directory (/home/kivy/android/python-for-android in the VM) I can successfully run git clean -dxf all day long. 

Bill Eaton

unread,
Apr 8, 2014, 12:45:07 AM4/8/14
to kivy-...@googlegroups.com
If I use --verbose switch for buildozer, it seems to be ignoring the path I supplied in buildozer.spec for py4a:
# Install platform
# Run 'git clean -dxf'
# Cwd /home/kivy/Dropbox/freebird/python_ebird_wrapper/.buildozer/android/platform/python-for-android
fatal
: Not a git repository (or any parent up to mount point /home/kivy/Dropbox)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

# Command failed: git clean -dxf

and here is the lines from buildozer.spec:
# (str) python-for-android git clone directory (if empty,it will be automatically cloned from github)
android
.p4a_dir = /home/kivy/android/python-for-android


Ben Rousch

unread,
Apr 8, 2014, 6:25:27 AM4/8/14
to kivy-...@googlegroups.com
Are those mounted as VM shared folders? There can be permissions issues if some of the code or resources are on a share, so move it all into the VM.


--
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.

Bill Eaton

unread,
Apr 8, 2014, 11:54:50 PM4/8/14
to kivy-...@googlegroups.com
Ben,

I've made some more progress but it's a real struggle to get everything in the VM to behave. Per your suggestion, I moved all of my source and dependent files to a directory local to the VM.

Then I had errors related to virtualenv, so I did
sudo pip  install --upgrade virtualenv
Now I'm getting
Unable to locate package arm-linux-androideabi-gcc
I'm going to poke around some more and see if I can figure it out. One more curious detail from Buildozer messages is related to NDK:
NDK located at /home/kivy/android/android-ndk-r8c
NDK version
is r9c
Hopefully, r9c is not a problem. I didn't set this and didn't do anything with installing ndk.


Ben Rousch

unread,
Apr 9, 2014, 6:47:50 AM4/9/14
to kivy-...@googlegroups.com

Did you update the components as specified in the readme on the desktop?

Bill Eaton

unread,
Apr 9, 2014, 2:28:47 PM4/9/14
to kivy-...@googlegroups.com
> Did you update the components as specified in the readme on the desktop?

Yes. Everything is updated. Today I'm running the VM from a different machine. I have a newer version of buildozer. Now the error message says
...
...
Entering in ARM enviromnent
Unable to find compiler (arm-linux-androideabi-gcc) !!
1. Ensure that SDK/NDK paths are correct
2. Ensure that you've the Android API 14 SDK Platform (via android tool)
# Command failed: ./distribute.sh -m "openssl kivy" -d "freebird"

So naturally, I try the command myself from Terminal
~/android/python-for-android/./distribute.sh -m "openssl kivy" -d "freebird"

And it works! Maybe the command fails because it's saying a distribution already exits and you need to hit enter to wipe it out or Ctl+C to quit and it hangs there.

Maybe if I continue on to run ./build.py manually, I can get an APK, but then I'm back where I started: I don't know how to get dependent files (TTF and DB) into my apk.






Reply all
Reply to author
Forward
0 new messages