kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.1k stars 1.81k forks source link

Google requiring API Target 26 in Aug/Nov 2018 #1219

Closed gorgonaut04 closed 5 years ago

gorgonaut04 commented 6 years ago

Just wanted to put it on the devs’ radar. We’ve been limited to 19 for the last couple years, afaik, but kivy will need to support targeting 26 for new apps starting in August, and for app updates starting in November: https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html?m=1

If there’s currently a straightforward way to target 21 or higher then I’ll stand corrected and be very interested in hearing how.

Zen-CODE commented 6 years ago

Looking into this now, when setting target API as as 26, it tries to download:

    Downloading http://dl.google.com/android/android-sdk_r26-linux.tgz

which fails as this file does not exist. The one below does, so that's why it works with sdk 23.

   Downloading http://dl.google.com/android/android-sdk_r23-linux.tgz

So google have altered the path of the downloads? It also appears they have changed the location of some files and deprecated the "./android" command which now says you should use the "bin/sdkmanager" tool instead to install sdk's. But I can't find any mention of where they have moved the sdks for downloading. It seems "buildozer/target/android.py " file would need to be changed to use these need tools?

jb1123 commented 6 years ago

Google post mentioned at the beginning of this discussion reads:

In order to provide users with the best Android experience possible, the Google Play Console will require that apps target a recent API level:

Existing apps that are not receiving updates are unaffected. Developers remain free to use a minSdkVersion of their choice, so there is no change to your ability to build apps for older Android versions. We encourage developers to provide backwards compatibility as far as reasonably possible. Future Android versions will also restrict apps that don't target a recent API level and adversely impact performance or security.

Current p4a documentation says ndk r7, SDK 14 - this is years behind current versions. I've tried to build app with SDK=26 and NDK 15c but it has failed. API 27 requires NDK 16, since its platform is not supported in 15c. I haven't tried to use it but I presume it will fail. I've notices p4a uses gcc, gcc was deprecated in NDK r11 and replaced by Clang. Android development team retired ant form SDK a year ago (see https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it). P4a adopted gradle only last summer. It looks there is plenty to be done and not much time left to catch up. Fortunately Google made revamp easier: it only makes sense to use latest SDK/NdK while building and Android app...

gorgonaut04 commented 6 years ago

This seems to be the biggest issue facing Kivy (at least for Android devs). Is there some hope that there will be a re-vamp to support SDK 26+? In August, just 3 months away, no one will be able to create a new Kivy app for Android, and in November, any existing apps will be stuck as-is until/unless this is addressed. I need to figure out what I'm doing for current and in-development apps asap. Do we need a bounty?

inclement commented 6 years ago

Unless someone steps in to do the work (which would be welcome, and I can give some guidance), this is waiting on me having some serious time to work on p4a. I hope to get to it soon enough, but I'm not going to make any guarantees right now.

Edit: The hard part as far as I'm concerned is moving to clang. This probably shouldn't actually be a big issue, but I think it's the most unknown quantity involved.

Zen-CODE commented 6 years ago

@inclement. I would be happy to help out here, but it's not an area I am familiar with. I was going to take the following approach:

a. Get a VM building against API 27 on an 18.04 Mate Ubuntu OS using AndroidStudio for the SDK installation. b. Once that is working, clean up, snapshot that and make it publically available for those who need it. c. Dig into the the python-for-android and buildozer parts that need to automate this process

I think it's urgent to get a working build VM so the deadline is not a do-or-die. The full solution can then follow in time?

edit: I should probably try as use the commandline tools to install the sdk's, as we will probably need to use those via buildozer for the final solution?

gorgonaut04 commented 6 years ago

Sounds great to me! On Fri, May 11, 2018 at 5:31 AM Richard Larkin notifications@github.com wrote:

@inclement https://github.com/inclement. I would be happy to help out here, but it's not an area I am familiar with. I was going to take the following approach:

a. Get a VM building against API 27 on an 18.04 Mate Ubuntu OS using AndroidStudio for the SDK installation. b. Once that is working, clean up, snapshot that and make it publically available for those who need it. c. Dig into the the python-for-android and buildozer parts that need to automate this process

I think it's urgent to get a working build VM so the deadline is not a do-or-die. The full solution can then follow in time?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/1219#issuecomment-388349993, or mute the thread https://github.com/notifications/unsubscribe-auth/AKTLxybbp6nWO0_nTmyvmsk1o0HArVaLks5txYScgaJpZM4RZ5U5 .

inclement commented 6 years ago

From my point of view, this issue is not with creating a VM but with changing p4a's code to support the latest NDK and SDK. The important steps (which can be done semi-independently) are:

1) Make sure p4a works with API 27, using an up to date Android SDK. I haven't tried this at all, but it shouldn't be too hard, even if it requires a few small changes.

2) Make p4a work with the current NDK. This means making it use clang instead of gcc, as gcc is no longer available. I think this is already working with jni recipes (like sdl2), but the other recipe types use gcc explicitly. In principle this shouldn't be too hard, the process for switching to clang is fairly clear (I've tried it briefly before), but messing with the compiler toolchain inevitably brings up issues to fix and I can't predict how much work will be needed. It could also be possible that using clang would have bigger problems to solve but I hopefully not.

Zen-CODE commented 6 years ago

Yes, the VM is my thing for a few reasons. I wanted to (a) check building works on 18.04, (b) be able to experiment with safe snapshots and (c) be able to distribute a working build VM.

But that need not concern you. I will post here when I hit issues and need your assistance. If you need to make changes to p4a, you could perhaps do that on a branch that I can pull and test on. I can also push there with any changes I need to make. I will try with sdk = 27 in the buildozer.spec. You mention a different NDK? What should that be?

Lastly,with regards to gcc vs. clang, don't know much but am willing to learn if you can point me to some docs on changes that will need to be made, which version I need to install etc.

I may need a bit of baby sitting getting started, but will document my learning so this whole process is a bit less "black box" like. I think many people would like to help, but it's not at all obvious how to on a project this size. And it's a bit daunting getting started when no docs exists. I know you do tons, and would like to help relieve you, but how to do that is the question...:-)

inclement commented 6 years ago

You mention a different NDK? What should that be?

I just mean the latest NDK release from https://developer.android.com/ndk/downloads/ , currently r17. The main change is likely to be the need to move to clang, I don't expect anything else in particular to break.

Lastly,with regards to gcc vs. clang, don't know much but am willing to learn if you can point me to some docs on changes that will need to be made, which version I need to install etc.

On p4a's side, it currently chooses a gcc toolchain to use, and uses the path to that later in the build process. It does this here. I think this needs to be changed to look for the clang toolchain instead.

Beyond that, I would basically proceed by trying to change it and seeing what breaks. I don't have a deep idea about what will need doing. There is some clang documentation at https://developer.android.com/ndk/guides/standalone_toolchain#working_with_clang , and I've found before that since many projects have had to make the same change there are plenty of questions already asked online about the problems that come up.

Just to note, while this does need doing, NDK r16 should actually work currently using gcc. I don't think this is going to break in the near future, unlike targeting older apis, although moving to clang is obviously still important.

Zen-CODE commented 6 years ago

Okay, so I've got the API-27 SDK installed and unzipped the latest NDK. Working from buildozer master.

# Android SDK found at /home/kivy/Android/Sdk
# Android NDK found at /home/kivy/Android/android-ndk-r16b

When I run 'buidozer android debug', I get. https://gist.github.com/Zen-CODE/9f982e93f437276b9968e1160061a26f

I am using the default-jre/default-jdk with ubuntu 18.04, which seems to be Java 11. Should I be using another java version? Or how to fix?

inclement commented 6 years ago

This error results from using a recent SDK with older versions of python-for-android, but it should be okay if you use p4a master. Did you set the p4a.branch = master option in buildozer.spec? (I think that's the right option name, it should already be there but commented out and set to the default value of stable).

Zen-CODE commented 6 years ago

Okay, I have done a git clone of https://github.xom/kivy/python-for-android into /home/kivy/Repos. So the clone lies in /home/kivy/Repos/python-for-android. In the buildozer.spec file, I have set

p4a.source_dir = /home/kivy/Repos/python-for-android

and I get

# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/Android/Sdk
# Android NDK found at /home/kivy/Android/android-ndk-r16b
# Run '/home/kivy/Android/Sdk/tools/android list sdk -u -e'
# Cwd /home/kivy/.buildozer/android/platform
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
"android" SDK commands can be translated to sdkmanager commands on a best-effort basis.
Continue? (This prompt can be suppressed with the --use-sdk-wrapper command-line argument
or by setting the USE_SDK_WRAPPER environment variable) [y/N]: y
Running /home/kivy/Android/Sdk/tools/bin/sdkmanager --list --verbose

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 5 more
# Command failed: /home/kivy/Android/Sdk/tools/android list sdk -u -e
# 
# 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
kivy@kivy-VirtualBox:~/Repos/kivy/examples/demo/touchtracer$ 

edit: master is definitely checked out in the python-for-android clone.

inclement commented 6 years ago

Ah, my mistake, the actual issue is that buildozer itself is not compatible with newer SDKs. It's still good that you're set up with p4a master, your clone method is what I'd recommend for working on this, but it isn't the immediate problem

The issue is that, as outlined by the message, newer SDKs replaced the android binary with sdkmanager. That means buildozer's attempt to query the sdk list here needs to be changed to use sdkmanager, or ideally to use sdkmanager or android depending on what's available.

The correct command is something like sdkmanager --list, as has automatically been guessed in your log, but in that case it looks like some java error has occurred. Does running /home/kivy/Android/Sdk/tools/bin/sdkmanager --list --verbose work if you do it directly?

Zen-CODE commented 6 years ago

Running "./android list sdk" gives the same error as does the sdkmanager. So I downgraded to openjdk-8 and it sorted that issue. Now I get a venv issue?

https://gist.github.com/Zen-CODE/d2210ec72984eebd48f286d9fc96b315

inclement commented 6 years ago

Do you have virtualenv installed?

Zen-CODE commented 6 years ago
kivy@kivy-VirtualBox:~/Repos/kivy/examples/demo/touchtracer$ pip install virtualenv
Collecting virtualenv
  Using cached https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0

But still get same error.

inclement commented 6 years ago

Is the virtualenv executable in your $PATH, so you get some answer from which virtualenv? That's the method p4a uses to find it, I'm not sure what would cause it to not work here.

Zen-CODE commented 6 years ago

Okay, progress. I now get

Error compiling Cython file:
------------------------------------------------------------
...
    cdef:
        bcm.DISPMANX_UPDATE_HANDLE_T hdl
        bcm.UpdateHandle U
    hdl = bcm.vc_dispmanx_update_start( priority )
    if hdl == 0:
        raise bcm.BCMDisplayException("Couldn't open handle to update-start")
                ^
------------------------------------------------------------

kivy/lib/vidcore_lite/egl.pyx:619:17: cimported module has no attribute 'BCMDisplayException'

  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Repos/kivy/examples/demo/touchtracer/.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

Which I think is a cython version issue. Will downgrade cython and try again....

inclement commented 6 years ago

Rather than downgrading cython, could you make sure you're using kivy master? You can set kivy==master in the requirements, as normal.

Zen-CODE commented 6 years ago

Still get the same error. It did pull master now. cython version is 28.3. Perhaps a clean or distclean?

inclement commented 6 years ago

Might be worth it. I do recognise this error as a cython problem that was fixed at some point, so some cython version should definitely work.

Zen-CODE commented 6 years ago

clean fixed that. Now getting to java errors? https://gist.github.com/Zen-CODE/36db7280eba0d98207241b10c18f10d4

inclement commented 6 years ago

Ah, this is good, it looks like the build is almost completed at the point it fails.

This error is new to me, though. It looks like some kind of ssl problem when downloading gradle. Do you get the same message (without the p4a stuff) if you navigate to home/kivy/Repos/kivy/examples/demo/touchtracer/.buildozer/android/platform/build/dists/myapp/ and run ./gradlew assembleDebug?

Zen-CODE commented 6 years ago

Yes. https://gist.github.com/Zen-CODE/e9624b4f8eb27635e9472a5525bade3a

Zen-CODE commented 6 years ago

Downloading gradle now. Fixed via the 18.04 tip here: https://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty

inclement commented 6 years ago

Oh, nice find, I've never seen anything like it before.

Zen-CODE commented 6 years ago

Built!!! :-)

# Android packaging done!
# APK myapp-0.1-debug.apk available in the bin directory

Will test shortly

gorgonaut04 commented 6 years ago

Thanks for working on this guys! Hopefully there's a recap or updated build process down the line, but I'm really looking forward to upgrading my apps to the latest sdks. I haven't had to deal with runtime permissions requests on Android yet, but I'm guessing we'll need to update (for instance) the plyer gps for android to handle this permission request like it already does on iOS :-P

On Fri, May 18, 2018 at 3:07 PM Richard Larkin notifications@github.com wrote:

Built!!! :-)

Android packaging done!

APK myapp-0.1-debug.apk available in the bin directory

Will test shortly

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/1219#issuecomment-390345284, or mute the thread https://github.com/notifications/unsubscribe-auth/AKTLx5AJSEuhWzSt0Dm_ZjMVaDHrn1RQks5tz0YXgaJpZM4RZ5U5 .

Zen-CODE commented 6 years ago

The APK installs but the app crashes. Will launch with buildozer and post the logs.... @gorgonaut04. My pleasure. I see my submission to the iStore today also warned that we need to build using the iOS 11 SDK. It all keeps moving! :-)

We identified one or more issues with a recent delivery for your app, "CAMI-Apps". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
SDK Version Issue - In July 2018, iOS app updates submitted to the App Store will need to be built with the iOS '11.0' SDK or later, included in Xcode [9.0] or later. Make sure to update Xcode for future app deliveries.
Zen-CODE commented 6 years ago

Looks like the SDL compile/loading is faililng.

V/pythonutil( 3869): Checking pattern libcrypto.*\.so against libSDL2_image.so
V/pythonutil( 3869): Loading library: SDL2
D/dalvikvm( 3869): Trying to load lib /data/app-lib/org.test.myapp-2/libSDL2.so 0x4351f520
D/houdini ( 3869): [3869] Loading library(version: 3.4.7.44914 RELEASE)... successfully.
D/houdini ( 3869): [3869] Open Native Library /data/app-lib/org.test.myapp-2/libSDL2.so failed.
E/dalvikvm( 3869): dlopen("/data/app-lib/org.test.myapp-2/libSDL2.so") failed: dlopen failed: "/data/app-lib/org.test.myapp-2/libSDL2.so" has unexpected e_machine: 40
V/pythonutil( 3869): Library loading error: dlopen failed: "/data/app-lib/org.test.myapp-2/libSDL2.so" has unexpected e_machine: 40
V/pythonutil( 3869): An UnsatisfiedLinkError occurred loading SDL2
W/System.err( 3869): dlopen failed: "/data/app-lib/org.test.myapp-2/libSDL2.so" has unexpected e_machine: 40
D/dalvikvm( 3869): GC_FOR_ALLOC freed 1652K, 44% free 6805K/11948K, paused 6ms, total 6ms
W/dalvikvm( 3869): No implementation found for native Lorg/libsdl/app/SDLActivity;.nativeSetEnv:(Ljava/lang/String;Ljava/lang/String;)V
D/AndroidRuntime( 3869): Shutting down VM
W/dalvikvm( 3869): threadid=1: thread exiting with uncaught exception (group=0x42f05500)
E/AndroidRuntime( 3869): FATAL EXCEPTION: main

Edit: This is part of the output. Please say if you need more. The splash screen displays, they then "The application has stopped working" message dispalys.

inclement commented 6 years ago

Are you running on an x86 device or emulator? I think the e-machine thing means libSDL2.so is compiled for arm but that this doesn't match your device architecture.

Zen-CODE commented 6 years ago

An atom based tablet but libhoudini takes care of that. Our current apk runs on this device no probs. I will test on an ARM device though and post those logs too...

On Sun, 20 May 2018, 16:33 Alexander Taylor notifications@github.com wrote:

Are you running on an x86 device or emulator? I think the e-machine thing means libSDL2.so is compiled for arm but that this doesn't match your device architecture.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/1219#issuecomment-390487111, or mute the thread https://github.com/notifications/unsubscribe-auth/ADYDK63HhluwjWbUhKewOVFpo2x_1FlHks5t0X6ngaJpZM4RZ5U5 .

Zen-CODE commented 6 years ago

On a Mecer ARM

V/pythonutil( 4416): Checking pattern libcrypto.*\.so against libSDL2_image.so
V/pythonutil( 4416): Loading library: SDL2
D/dalvikvm( 4416): Trying to load lib /data/app-lib/org.test.myapp-2/libSDL2.so 0x413ad490
E/dalvikvm( 4416): dlopen("/data/app-lib/org.test.myapp-2/libSDL2.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "srand" referenced by "libSDL2.so"...
V/pythonutil( 4416): Library loading error: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "srand" referenced by "libSDL2.so"...
V/pythonutil( 4416): An UnsatisfiedLinkError occurred loading SDL2
W/System.err( 4416): Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "srand" referenced by "libSDL2.so"...
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/dalvikvm( 4416): GC_FOR_ALLOC freed 2424K (5898), 51% free 3176K/6452K, paused 10ms, total 10ms
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/dalvikvm( 4416): GC_FOR_ALLOC freed 694K (448), 45% free 3594K/6452K, paused 9ms, total 9ms
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
D/skia    ( 4416): Flag is not 10
V/WindowManager(  504): Changing focus from Window{419df058 u0 org.test.myapp/org.kivy.android.PythonActivity} to Window{41c41628 u0 org.test.myapp/org.kivy.android.PythonActivity}
I/WindowManager(  504): Gaining focus: Window{41c41628 u0 org.test.myapp/org.kivy.android.PythonActivity}
W/dalvikvm( 4416): No implementation found for native Lorg/libsdl/app/SDLActivity;.nativeSetEnv:(Ljava/lang/String;Ljava/lang/String;)V
D/AndroidRuntime( 4416): Shutting down VM
W/dalvikvm( 4416): threadid=1: thread exiting with uncaught exception (group=0x410fa9a8)
E/AndroidRuntime( 4416): FATAL EXCEPTION: main
Zen-CODE commented 6 years ago

Complete log of "buildozer android debug" after "buildozer distclean" here: https://gist.github.com/Zen-CODE/ca841508c5c4a48b6c7b864e86c942b9

Zen-CODE commented 6 years ago

@inclement. Any suggestions as to what I can look at? Willing to read/learn/try, but not sure where to start?

inclement commented 6 years ago

Just to check I understand where you currently are (I think I misunderstoood the previous post), testing on an arm device gives the No implementation found for native Lorg/libsdl/app/SDLActivity;.nativeSetEnv:(Ljava/lang/String;Ljava/lang/String;)V error?

I don't know what would cause this, I don't think I've seen this error before. Is it with python2 or python3crystax, and if so does using the other one work?

Zen-CODE commented 6 years ago

The ARM device fails with the below.

D/dalvikvm( 4416): Trying to load lib /data/app-lib/org.test.myapp-2/libSDL2.so 0x413ad490
E/dalvikvm( 4416): dlopen("/data/app-lib/org.test.myapp-2/libSDL2.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "srand" referenced by "libSDL2.so"...

Complete: https://gist.github.com/Zen-CODE/ca841508c5c4a48b6c7b864e86c942b9

The build is successful, but running fails with that message...

inclement commented 6 years ago

I found some old links suggesting using NDK 10 or higher to fix this, but it looks like you're using r16b, is that correct?

I guess that does suggest it could be an NDK version error, but it's a bit mysterious to me how or why. You could try using the CrystaX NDK just in case, since it's somewhat different to the current Android NDK.

Zen-CODE commented 6 years ago

Yes, using r16b. Would I need to use Python3 for the Crystax NDK? I've only been trying using 2.7, but I can setup 3 if you think it's worth it...

inclement commented 6 years ago

No, python 2 is fine. The CrystaX NDK is just a drop-in replacement for the normal NDK in most circumstances.

On 06/06/18 22:11, Richard Larkin wrote:

Yes, using r16b. Would I need to use Python3 for the Crystax NDK? I've only been trying using 2.7, but I can setup 3 if you think it's worth it...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/1219#issuecomment-395215167, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNQm3zifMJGoaLn2CQ6peN0mdAWdGiKks5t6EVvgaJpZM4RZ5U5.

40four commented 6 years ago

Thanks so much for working on this @Zen-CODE & @inclement ! EDIT: actually I was able to get roll-out started. My fault rookie mistake!

Zen-CODE commented 6 years ago

@40four. No worries :-) Are you sure it's not just a warning, and won't actually allow you to submit? What is exact message it gives you?

40four commented 6 years ago

Yeah my fault, I just didn't know what I was doing in the play console. I hadn't finished some of the other requirements!

Zen-CODE commented 6 years ago

@inclement. Looking in the crystax platform folder, it only seems to support up to API 21...

[INFO]:    Using Crystax NDK r16b
[INFO]:    Found virtualenv at /usr/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[WARNING]: ndk_platform doesn't exist: /home/kivy/Android/crystax-ndk-10.3.2/platforms/android-27/arch-arm
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[ERROR]:   python-for-android cannot continue; aborting
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy==master,crystax --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Repos/kivy/examples/demo/touchtracer/.buildozer/android/platform/build

Update: Fixed the above by copying the android-27 folder from the r16b zip. Running a new build now...

Zen-CODE commented 6 years ago

It now builds with crystax and still fails on the SDL2, but with a different error.

https://gist.github.com/Zen-CODE/7ed1bbcb562bfa93ea745ac8c50904e9

06-08 15:16:47.987 24752 24752 V pythonutil: Checking pattern libcrypto.*\.so against libmain.so
06-08 15:16:47.987 24752 24752 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2.so
06-08 15:16:47.988 24752 24752 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_image.so
06-08 15:16:47.988 24752 24752 V pythonutil: Loading library: SDL2
06-08 15:16:47.995 24752 24752 V pythonutil: Library loading error: dlopen failed: cannot locate symbol "__aeabi_memclr8" referenced by "/data/app/org.test.myapp-1/lib/arm/libSDL2.so"...
06-08 15:16:47.995 24752 24752 V pythonutil: An UnsatisfiedLinkError occurred loading SDL2
06-08 15:16:47.995 24752 24752 W System.err: dlopen failed: cannot locate symbol "__aeabi_memclr8" referenced by "/data/app/org.test.myapp-1/lib/arm/libSDL2.so"...
06-08 15:16:47.999 24752 24752 D PhoneWindowEx: Ex2. SystemProperties.get result >> #ff000000

Update: It seems like the building of SDL2 is the cause of both these APK's failing. How can I look more closely at that? Is there a way I can get buildozer to halt when it builds that file? Or tell it only to build libSDL2.so?

AndreMiras commented 6 years ago

Hi guys, TL;DR the whole conversation. But I think I can help for the new SDK part @inclement In fact I already use a very up to to date SDK with p4a/buildozer and it works OK, see https://github.com/AndreMiras/EtherollApp/blob/v20180531/dockerfiles/Dockerfile-android#L57

Basically I download SDK tools version 3859397 from https://developer.android.com/studio/index.html and call sdkmanager a few time to update and install API. I have a Makefile here which is pretty straightforward, see https://github.com/AndreMiras/dockerfiles/blob/master/buildozer_android_new/android_sdk.mk

I can convert it to a python to make a buildozer pull request if you guys are interested. Currently I just symlink it directly to ${HOME}/.buildozer/android/platform/android-sdk-20 and it works like a drop-in replacement with existing buildozer code. If you're interested then I would split this conversation in a dedicated buildozer ticket and start working from here.

Zen-CODE commented 5 years ago

Thanks, will look into that. Sorry for the delay, but currently working on urgent projects. Will get back to this as soon as time allows.

Zen-CODE commented 5 years ago

Great news. Just successfully build and run touchtracer using ndk r16b and API 27 for python 2. I've tried so much that I'm not sure exactly what the crucial step was. I suspect it was using the android tool to handle updates and platform tools installations. But can't be 100% sure. Either way, it's a big relief to know API 27 is do-able :-)

Will try python 3 this week...

inclement commented 5 years ago

Great, very nice work!

On 08/07/18 10:08, Richard Larkin wrote:

Great news. Just successfully build and run touchtracer using ndk r16b and API 27 for python 2. I've tried so much that I'm not sure exactly what the crucial step was. I suspect it was using the android tool to handle updates and platform tools installations. But can be 100% sure. Either way, it's a big relied to know API 27 is do-able :-)

Will try python 3 this week...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/1219#issuecomment-403273811, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNQmyBbDsWAlZi_0Zounql8N_dLB1aHks5uEcwFgaJpZM4RZ5U5.

Zen-CODE commented 5 years ago

Okay, so now I'm trying (on 16.04) with Python 3.5.2 using the crystax 10.3.2 NDK and I get the following:

[INFO]:    Prebuilding kivy for armeabi-v7a
[INFO]:    kivy has no prebuild_armeabi_v7a, skipping
[INFO]:    # Building recipes
[INFO]:    Building hostpython3crystax for armeabi-v7a
[INFO]:    Building sdl2_image for armeabi-v7a
[INFO]:    Building sdl2_mixer for armeabi-v7a
[INFO]:    Building sdl2_ttf for armeabi-v7a
[INFO]:    Building python3crystax for armeabi-v7a
[INFO]:    Building sdl2 for armeabi-v7a
[WARNING]: Couldn't find executable for CC. This indicates a problem locating the {} executable in the Android NDK, not that you don't have a normal compiler installed. Exiting.
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=touchtracer --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Repos/Python3/kivy/examples/demo/touchtracer/.buildozer/android/platform/build