Building an APK for android from a Python/Kivy source code - android

I am on trying to move a python/kivy app from a virtual machine to android device. Here is what I did:
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python2.7 setup.py install
to get buidozer. Then change the project directory from the shared folder to code/kivy/examples/demo and then type buildozer init to get buildozer spec and finally type buildozer android debug deploy run to build the apk.
I got the following error message:
Run prebuild
Call prebuild_hostpython
Call prebuild_python
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urN Python-2.7.2/configure ltib/rpm/BUILD/Python-2.7.2/configure
|--- Python-2.7.2/configure 2011-06-11 11:46:28.000000000 -0400
|+++ ltib/rpm/BUILD/Python-2.7.2/configure 2011-11-14 12:10:41.011373524 -0500
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 25
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urN Python-2.7.2/Makefile.pre.in ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in
|--- Python-2.7.2/Makefile.pre.in 2011-06-11 11:46:26.000000000 -0400
|+++ ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in 2011-11-14 12:10:41.013373444 -0500
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
6 out of 6 hunks ignored
patching file setup.py
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
6 out of 6 hunks ignored -- saving rejects to file setup.py.rej
# Command failed: ./distribute.sh -m "kivy" -d "myapp"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
Thanks in advance for any help.

To fix this issue run this command buildozer android clean
and then rebuild it using buildozer android debug or automatically run using buildozer android debug deploy run.
And also this link might help.

Looks like you've just made a new ios/apk package. It is persisent with buildozer... All you need to do though is
buildozer android update
buildozer android release

Related

Build apk using buildozer and kivy Error with gradlew (new project)

I have been able to build an .apk file by kivy and python2.7 using buildozer, and the app works fine on phone-device. After a while, i started a new project in a new folder (together with new main.py), but when i do buildozer android debug, the Error attached keeps coming out, something with gradlew. In my previous builds, this never happens.
In this new main.py, i previously use numpy module, but this module cause Error also in the build-up. So i removed it and rewrite the code. Now another Error occurs (the Error because gradlew).
I have tried added android in the requirements. Does not work. (although i prefer to use the default buildozer.spec).
I appreciate some inputs on this.
*Also, i found some official resources, either from Github or the buildozer site are a bit inconsistent. Is there a detail resource such that i may install buildozer correctly, also the guide for the buildozer.specs?
I even not fully remember why the previous app works well..because i also bumped into several problems before the 1st App works fine.
** When i debug the new main.py in the old folder, the build process succeed.**
** (I also use the same package.name and package.domain as the 1st App) **
Thanks in advance.
STDERR:
[INFO]: STDOUT:
Unzipping /home/kivy/.gradle/wrapper/dists/gradle-3.3-all/2n0i7hqatcbtk57vvql575dbap/gradle-3.3-all.zip to /home/kivy/.gradle/wrapper/dists/gradle-3.3-all/2n0i7hqatcbtk57vvql575dbap
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:157)
at org.gradle.wrapper.Install.access$400(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:67)
at org.gradle.wrapper.Install$1.call(Install.java:44)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)
[INFO]: STDERR:
[INFO]: COMMAND:
cd /home/kivy/Desktop/blablaapp/.buildozer/android/platform/build/dists/myapp && ./gradlew assembleDebug
[WARNING]: ERROR: ./gradlew failed!
# Command failed: /usr/bin/python -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name myapp --name 'My Application' --version 0.1 --package org.test.myapp --android_api 19 --minsdk 9 --private /home/kivy/Desktop/sudoku_newbie/.buildozer/android/app --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir=/home/kivy/Desktop/sudoku_newbie/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
This error mostly occurs when you've interrupted the system when Gradle was downloading.
You can simply fix this by manually downloading gradle from https://services.gradle.org/distributions/gradle-4.4-all.zip
Then replace the gradle-4.4-all.zip.part in /your/home/path/.gradle/wrapper/dists/gradle-4.4-all/4th6d42q1kgladv9hkn2iehgi5 with the new dowloaded file
I had the same problem to solve mine I downloaded an earlier version of buildozer and it worked

NDK GCC : Could not determine GCC version

I'm trying to execute an Android sample that uses JNI to call C code from a Android Java Activity.
( Hello-jni) using Android Studio in ubuntu 15.04
I get the following error while building my project :
Error:Execution failed for task ':app:
compileHello-jniArm64- v8aDebugAllSharedLibraryHello-jniMainC'.
> No tool chain is available to build for platform 'arm64-v8a':
- Tool chain 'ndk-gcc' (GNU GCC): Could not determine GCC version:
failed to execute aarch64-linux-android-gcc -dM -E -.
Running gradle with the --info flag to determine the command being run:
gradlew :app:compileHello-jniArm64- v8aDebugAllSharedLibraryHello-jniMainC --info
In the output you should see a command containing aarch64-linux-android-gcc -dM -E - with a full path. Check that you do actually have this binary at the path shown (it should have been included in the android ndk).
Assuming you do, try running the command yourself. It will read from stdin and print a bunch of constants to stdout (gradle is trying to parse the version from this), but you want to see stderr:
echo '' | ./aarch64-linux-android-gcc -dM -E - 1>/dev/null
If the command fails, an error should be shown which can hint at the problem. In my case it was trying to include a folder 4.9.x but I had a folder named 4.9. Most likely there will be a different problem with your setup.

Buildozer error : Command failed: ./distribute.sh -m "kivy" -d "randomapp"

I have a simple project written in python (kivy) and i am using buildozer to make .apk file for Android platform. But for some reason the compiling it's not sucessufull. I think it's a problem with the pythoh-for-android module because it gives me the error:
# Command failed: ./distribute.sh -m "kivy" -d "randomapp"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
But when i added log_level = 2 , i see that it says that lpng is missing:
/home/shakle17/shakle/rand0m/.buildozer/android/platform/python-for-android/bui/home/shakle17/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpng
collect2: error: ld returned 1 exit status
I am using Fedora23 and i've installed all libraries (libpng , libpng-devel for x64 and i686 platform) in the dnf package manager but still the problem remains .
I've fixed it . I've installed libpng from the official site, than run : buildozer android clean and after that it was fixed

ndk-gdb cannot find gdb.setup but it is there under x86

Cocos2d-x 3.7.1 + ndk r10e project on Mac trying to debug in Eclipse. Days pass and the errors keep coming...
I can build and run using cocos compile and cocos run with -p android -m debug --ndk-mode NDK_DEBUG=1 from the terminal in proj.android.
My app runs Ok (eventually) on my x86 emulator no problem.
Typing 'ndk-gdb' in the terminal from ./proj.android and I get the error
ERROR: Could not find gdb.setup under ./libs/
BUT the file gdb.setup (and gdbserver & libcocos2dcpp.so) can be seen in ./proj.android/libs/x86 !?
My AndroidManifest.xml includes android:debuggable="true"
My jni/Application.mk includes APP_ABI := x86 (only)
If anyone can tell me how I can diagnose or fix this problem then I guess I owe them a beer (in Yorkshire btw)
UPDATE: I have tried running up GDB using the --verbose flag. The output shows
Using gdb setup init: ./libs/armeabi/gdb.setup
Using app out directory: ./obj/local/armeabi
Guess I need to change to settings/init file somewhere??
I ran into the same problem. It seems something changed in recent version of Android Build tools.
The trick is:
ERROR: Could not find gdb.setup under ./libs/
It expects gdb.setup is in the directory libs but NOT libs/armeabi
so the simple workground is to copy gdb.setup and gdbserver from "libs/cpu" to "libs" and it works like a magic!
This is a bug caused by adb from android sdk.Issue 191085: ndk-gdb issue - Could not find gdb.setup under ./libs/ (even though it's there)
Currently previewl channel's adb whose version is 1.0.35 still has the same problem.
Without revert adb to 1.0.31.A simple workaround would be modify ndk-gdb a little: change the line if [ $? = 0 ]; then which is below adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c "ls lib/*.bc" to if [ $? = 1 ]; then

cocos2d-2.0-rc2-x-2.0.1 Hello World sample doesn't work using cygwin on windows8

I am unable to build helloWorld sample to get .so to run it in eclipse. I have imported project successfully and changed variable to my root path as required. this is my build_native.sh. I am pasting the only change I made in that file
NDK_ROOT_LOCAL=/cygdrive/e/android-ndk-r8
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d
And my NDK is working fine because I have executed HelloWorld sample of NDK successfully. My SDK version is 20 and NDK version is 8 and I am using cygwin above than 1.7.. I have executed the chown on my NDK directory.. But when I run the command ./build_native.sh in HelloWorld sample program for cocos2d I get this error
E:/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm- linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/png.a: No such file: Permission denied
collect2: ld returned 1 exit status
and when I search for png.a in my NDK directory window can't locate that file. I am confused whether it's a permission error or File isn't there. But I have the latest NDK if file isn't there how come anyone will able to run cocos2d-x??? Need Help!!!
It seems like the permissions on built files were missing when I tried as well.
$ ls -l obj/local/armeabi/png.a
---------- 1 someuser Domain Users 912618 Jul 12 18:23 obj/local/armeabi/png.a
There is a link suggested on the forum which doesn't seem to be accessible right now.
Anyway, to fix, you can set the permission on the files.
$ cd obj/local/armeabi/
$ chmod 664 *.a
$ cd ../../..
Edit: A better fix may be to set the default permissions in /etc/fstab to
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
Following this, you should be able to run ./build_native.sh.
A command you could use to locate all files below the current directory which have no (read/write) permission available on them is find . -type f -perm 0
See this answer to set write permissions on all files below your working directory.
Consider going through a tutorial on chmod to understand the concept of permissions in linux/unix in case you're unfamiliar with them.

Categories

Resources