Skip to content

SDL2 built APK not seeming to work #2621

@rayzchen

Description

@rayzchen

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.10.5
  • OS: Ubuntu Linux
  • Kivy: Not used
  • Cython: 0.29.30
  • OpenJDK: 1.11.0

Description

I'm trying to make an SDL2 app. When I install the apk, the kivy loading screen shows and then it changes to landscape mode with a reduced resolution, then just stays as a black screen until the app is closed.

buildozer.spec

Not used

Command:

docker build -t testapp .
docker run -it testapp

Spec file:

Not used 

Dockerfile:

FROM python:latest

RUN dpkg --add-architecture i386 && \
    apt-get update && \
    # apt-get install -y software-properties-common && \
    # add-apt-repository "deb http://security.debian.org/debian-security stretch/updates main" && \
    # apt-get update && \
    apt-get install -y \
        wget \
        curl \
        unzip \
        make \
        zip \
        openjdk-11-jdk \
        build-essential \
        ccache \
        git \
        zlib1g-dev \
        ant \
        ccache \
        autoconf \
        libtool \
        libssl-dev \
        libncurses5:i386 \
        libstdc++6:i386 \
        zlib1g:i386 \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir git+https://github.com/kivy/python-for-android.git@develop pysdl2 pysdl2-dll cython

WORKDIR /root/app
RUN wget https://raw.githubusercontent.com/kivy/python-for-android/develop/ci/makefiles/android.mk
RUN make -f android.mk

RUN update-java-alternatives -s /usr/lib/jvm/java-1.11.0-openjdk-amd64/

COPY main.py .p4a .
RUN p4a create
CMD p4a apk \
    --private . \
    --package org.example.test \
    --name "My application" \
    --version 0.1.0

main.py:

import sdl2.ext
sdl2.ext.init()
window = sdl2.ext.Window("Hello World!", size=(960, 540))
sdl2.ext.draw.fill(window.get_surface(), (255, 0, 0))
window.show()
processor = sdl2.ext.TestEventProcessor()
processor.run(window)
sdl2.ext.quit()

.p4a file:

--bootstrap=sdl2
--requirements=python3,pysdl2
--arch arm64-v8a
--sdk-dir /root/.android/android-sdk
--ndk-dir /root/.android/android-ndk

Logs

// REPLACE ME: Paste the build output containing the error
// Keep the triple grave accent (a.k.a. backquote/backtick) to have the code formatted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions