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

kivy app crashing on launch #982

Closed dessant closed 5 years ago

dessant commented 7 years ago

From @Terrydaktal on January 2, 2017 0:30

after advice from issue #4864 -i have rebuilt python-for-android and buildozer from the repo -i have changed buildozer.spec to include all modules imported into python: buildozer.spec.txt -i have used android_new and built an apk with that, and another apk with just android as well

both applications however still crash, the error produced when using only 'android' to compile, is overcome when using android_new and using python2 in the requirements, however the error now is such: i will provide the full logcat: particularly looking at that specified child already has a parent error, this is an error i got before when using android_new, i looked up solutions at the time, but none helped me, the suggestions were to make sure everything is up to date, but everything is

01-02 00:12:02.431 861 1242 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 20837

01-02 00:12:02.463 861 872 I ActivityManager: Start proc org.test.myapp for activity org.test.myapp/org.kivy.android.PythonActivity: pid=26524 uid=10108 gids={50108, 1028, 1015, 1023, 3003}

01-02 00:12:02.483 240 240 I BufferQueue: Starting org.test.myapp setConsumerName: Starting org.test.myapp

01-02 00:12:02.483 240 240 I BufferQueue: Starting org.test.myapp setDefaultBufferSize: w=1080, h=1920

01-02 00:12:02.505 240 911 I BufferQueue: Starting org.test.myapp connect: api=2 producer=(861:system_server) producerControlledByApp=false

01-02 00:12:02.505 240 8923 I BufferQueue: Starting org.test.myapp new GraphicBuffer needed

01-02 00:12:12.453 861 881 E WindowManager: Starting window AppWindowToken{46452e58 token=Token{434905b8 ActivityRecord{43b7b1f8 u0 org.test.myapp/org.kivy.android.PythonActivity t168}}} timed out

01-02 00:12:12.455 240 8923 I BufferQueue: Starting org.test.myapp disconnect: api=2

01-02 00:12:12.455 240 8923 I BufferQueue: Starting org.test.myapp getReleasedBuffers: returning mask 0xffffffff

01-02 00:12:12.460 240 240 I BufferQueue: Starting org.test.myapp consumerDisconnect

01-02 00:12:12.461 240 240 I BufferQueue: Starting org.test.myapp ~BufferQueue

01-02 00:12:59.471 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setConsumerName: org.test.myapp/org.kivy.android.PythonActivity

01-02 00:12:59.471 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setDefaultBufferSize: w=1, h=1

01-02 00:12:59.484 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setDefaultBufferSize: w=1080, h=1920

01-02 00:12:59.488 861 881 I WindowManager: Gaining focus: Window{46602b78 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-02 00:12:59.514 240 8923 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity connect: api=1 producer=(26524:org.test.myapp) producerControlledByApp=true

01-02 00:12:59.514 240 912 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:12:59.598 26524 26551 I python : /data/data/org.test.myapp/files/app

01-02 00:12:59.626 26524 26551 I python : ('Android path', ['/data/data/org.test.myapp/files/app/lib/python27.zip', '/data/data/org.test.myapp/files/app/lib/python2.7/', '/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/', '/data/data/org.test.myapp/files/app/lib/python2.7/site-packages/', '/data/data/org.test.myapp/files/app'])

01-02 00:12:59.652 26524 26551 I python : ('os.environ is', {'ANDROID_APP_PATH': '/data/data/org.test.myapp/files/app', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'LOOP_MOUNTPOINT': '/mnt/obb', 'ANDROID_SOCKET_zygote': '10', 'BOOTCLASSPATH': '/system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/webviewchromium.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/CustomProperties.jar:/system/framework/mediatek-telephony-common.jar:/system/framework/mediatek-tablet.jar:/system/framework/dolby_ds.jar', 'ANDROID_PROPERTY_WORKSPACE': '9,0', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'ANDROID_STORAGE': '/storage', 'ANDROID_BOOTLOGO': '1', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'ANDROID_ASSETS': '/system/app', 'LD_LIBRARY_PATH': '/vendor/lib:/system/lib:/custom/lib', 'PYTHONPATH': '/data/data/org.test.myapp/files/app:/data/data/org.test.myapp/files/app/lib', 'PYTHON_NAME': 'python', 'PYTHONOPTIMIZE': '2', 'ANDROID_PRIVATE': '/data/data/org.test.myapp/files', 'USBOTG_STORAGE': '/storage/usbotg', 'ANDROID_ENTRYPOINT': 'main.pyo', 'CLASSPATH': '/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar', 'ANDROID_DATA': '/data', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'BOOTCLASSPATH_EX': '/system/framework/mediatek-op.jar', 'LD_PRELOAD': '/system/lib/libpldbgutil.so', 'ANDROID_ROOT': '/system', 'PYTHONHOME': '/data/data/org.test.myapp/files/app', 'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_ARGUMENT': '/data/data/org.test.myapp/files/app'})

01-02 00:12:59.666 240 911 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:12:59.696 861 881 I ActivityManager: [AppLaunch] Displayed Displayed org.test.myapp/org.kivy.android.PythonActivity: +57s244ms

01-02 00:12:59.698 26524 26551 I python : ['/data/data/org.test.myapp/files/app/lib/python2.7/site-packages', '/data/data/org.test.myapp/files/app/lib/site-python']

01-02 00:12:59.700 240 487 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:12:59.853 26524 26551 I python : ImportError: dlopen failed: "/data/data/org.test.myapp/files/app/_applibs/numpy/core/multiarray.so" not 32-bit: 2

01-02 00:13:00.163 861 881 I WindowManager: Losing focus: Window{46602b78 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-02 00:13:00.291 240 489 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity disconnect: api=1

01-02 00:13:00.292 240 489 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity getReleasedBuffers: returning mask 0xffffffff

01-02 00:13:00.417 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity consumerDisconnect

01-02 00:13:00.417 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity ~BufferQueue

01-02 00:14:49.420 861 879 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 20837

01-02 00:14:49.460 26818 26818 W System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

01-02 00:14:49.468 26818 26818 E AndroidRuntime: Process: org.test.myapp, PID: 26818

01-02 00:14:49.468 26818 26818 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

01-02 00:14:49.475 240 240 I BufferQueue: Starting org.test.myapp setConsumerName: Starting org.test.myapp

01-02 00:14:49.475 240 240 I BufferQueue: Starting org.test.myapp setDefaultBufferSize: w=1080, h=1920

01-02 00:14:49.485 861 1280 W ActivityManager: Force finishing activity org.test.myapp/org.kivy.android.PythonActivity

01-02 00:14:49.508 26887 26887 I DEBUG : [OnPurpose Redunant in preset_info] pid: 26818, tid: -1361051648, name: UNKNOWN >>> org.test.myapp <<<

01-02 00:14:49.786 861 1280 I WindowManager: Screenshot max retries 4 of Token{4351a688 ActivityRecord{443b0478 u0 org.test.myapp/org.kivy.android.PythonActivity t174 f}} appWin=Window{441aad30 u0 Starting org.test.myapp} drawState=1

01-02 00:14:49.813 240 912 I BufferQueue: Starting org.test.myapp connect: api=2 producer=(861:system_server) producerControlledByApp=false

01-02 00:14:49.814 240 489 I BufferQueue: Starting org.test.myapp new GraphicBuffer needed

01-02 00:14:49.828 240 240 I BufferQueue: Application Error: org.test.myapp setConsumerName: Application Error: org.test.myapp

01-02 00:14:49.828 240 240 I BufferQueue: Application Error: org.test.myapp setDefaultBufferSize: w=1, h=1

01-02 00:14:49.850 240 240 I BufferQueue: Application Error: org.test.myapp setDefaultBufferSize: w=940, h=362

01-02 00:14:49.857 861 881 I WindowManager: Gaining focus: Window{44288070 u0 Application Error: org.test.myapp}

01-02 00:14:49.863 240 911 I BufferQueue: Application Error: org.test.myapp connect: api=2 producer=(861:system_server) producerControlledByApp=false

01-02 00:14:49.864 240 489 I BufferQueue: Application Error: org.test.myapp new GraphicBuffer needed

01-02 00:14:50.289 861 885 W ActivityManager: Activity pause timeout for ActivityRecord{443b0478 u0 org.test.myapp/org.kivy.android.PythonActivity t174 f}

01-02 00:14:50.818 240 487 I BufferQueue: Application Error: org.test.myapp new GraphicBuffer needed

01-02 00:14:50.953 240 8923 I BufferQueue: Application Error: org.test.myapp new GraphicBuffer needed

01-02 00:14:50.958 240 487 I BufferQueue: Application Error: org.test.myapp queueBuffer: fps=1.84 dur=1088.87 max=953.43 min=135.44

01-02 00:14:51.018 861 881 I WindowManager: Losing focus: Window{44288070 u0 Application Error: org.test.myapp EXITING}

01-02 00:14:51.109 240 489 I BufferQueue: Application Error: org.test.myapp disconnect: api=2

01-02 00:14:51.109 240 489 I BufferQueue: Application Error: org.test.myapp getReleasedBuffers: returning mask 0xffffffff

01-02 00:14:51.120 861 1119 I ActivityManager: Process org.test.myapp (pid 26818) has died.

01-02 00:14:51.122 240 240 I BufferQueue: Application Error: org.test.myapp consumerDisconnect

01-02 00:14:51.122 240 240 I BufferQueue: Application Error: org.test.myapp ~BufferQueue

01-02 00:14:51.124 240 487 I BufferQueue: Starting org.test.myapp disconnect: api=2

01-02 00:14:51.124 240 487 I BufferQueue: Starting org.test.myapp getReleasedBuffers: returning mask 0xffffffff

01-02 00:14:51.139 240 240 I BufferQueue: Starting org.test.myapp consumerDisconnect

01-02 00:14:51.140 240 240 I BufferQueue: Starting org.test.myapp ~BufferQueue

01-02 00:14:51.625 861 1255 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 20837

01-02 00:14:51.634 240 240 I BufferQueue: Starting org.test.myapp setConsumerName: Starting org.test.myapp

01-02 00:14:51.634 240 240 I BufferQueue: Starting org.test.myapp setDefaultBufferSize: w=1, h=1

01-02 00:14:51.648 240 240 I BufferQueue: Starting org.test.myapp setDefaultBufferSize: w=1080, h=1920

01-02 00:14:51.672 861 872 I ActivityManager: Start proc org.test.myapp for activity org.test.myapp/org.kivy.android.PythonActivity: pid=26892 uid=10108 gids={50108, 1028, 1015, 1023, 3003}

01-02 00:14:51.686 240 911 I BufferQueue: Starting org.test.myapp connect: api=2 producer=(861:system_server) producerControlledByApp=false

01-02 00:14:51.687 240 487 I BufferQueue: Starting org.test.myapp new GraphicBuffer needed

01-02 00:14:51.978 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setConsumerName: org.test.myapp/org.kivy.android.PythonActivity

01-02 00:14:51.978 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setDefaultBufferSize: w=1, h=1

01-02 00:14:51.987 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity setDefaultBufferSize: w=1080, h=1920

01-02 00:14:51.991 861 881 I WindowManager: Gaining focus: Window{448d7c70 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-02 00:14:52.004 240 912 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity connect: api=1 producer=(26892:org.test.myapp) producerControlledByApp=true

01-02 00:14:52.005 240 489 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:14:52.076 26892 26921 I python : /data/data/org.test.myapp/files/app

01-02 00:14:52.084 26892 26921 I python : ('Android path', ['/data/data/org.test.myapp/files/app/lib/python27.zip', '/data/data/org.test.myapp/files/app/lib/python2.7/', '/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/', '/data/data/org.test.myapp/files/app/lib/python2.7/site-packages/', '/data/data/org.test.myapp/files/app'])

01-02 00:14:52.101 26892 26921 I python : ('os.environ is', {'ANDROID_APP_PATH': '/data/data/org.test.myapp/files/app', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'LOOP_MOUNTPOINT': '/mnt/obb', 'ANDROID_SOCKET_zygote': '10', 'BOOTCLASSPATH': '/system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/webviewchromium.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/CustomProperties.jar:/system/framework/mediatek-telephony-common.jar:/system/framework/mediatek-tablet.jar:/system/framework/dolby_ds.jar', 'ANDROID_PROPERTY_WORKSPACE': '9,0', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'ANDROID_STORAGE': '/storage', 'ANDROID_BOOTLOGO': '1', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'ANDROID_ASSETS': '/system/app', 'LD_LIBRARY_PATH': '/vendor/lib:/system/lib:/custom/lib', 'PYTHONPATH': '/data/data/org.test.myapp/files/app:/data/data/org.test.myapp/files/app/lib', 'PYTHON_NAME': 'python', 'PYTHONOPTIMIZE': '2', 'ANDROID_PRIVATE': '/data/data/org.test.myapp/files', 'USBOTG_STORAGE': '/storage/usbotg', 'ANDROID_ENTRYPOINT': 'main.pyo', 'CLASSPATH': '/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar', 'ANDROID_DATA': '/data', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'BOOTCLASSPATH_EX': '/system/framework/mediatek-op.jar', 'LD_PRELOAD': '/system/lib/libpldbgutil.so', 'ANDROID_ROOT': '/system', 'PYTHONHOME': '/data/data/org.test.myapp/files/app', 'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_ARGUMENT': '/data/data/org.test.myapp/files/app'})

01-02 00:14:52.125 240 487 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:14:52.141 26892 26921 I python : ['/data/data/org.test.myapp/files/app/lib/python2.7/site-packages', '/data/data/org.test.myapp/files/app/lib/site-python']

01-02 00:14:52.143 861 881 I ActivityManager: [AppLaunch] Displayed Displayed org.test.myapp/org.kivy.android.PythonActivity: +490ms (total +2s711ms)

01-02 00:14:52.147 240 8923 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity new GraphicBuffer needed

01-02 00:14:52.226 240 912 I BufferQueue: Starting org.test.myapp disconnect: api=2

01-02 00:14:52.226 240 912 I BufferQueue: Starting org.test.myapp getReleasedBuffers: returning mask 0xffffffff

01-02 00:14:52.241 240 240 I BufferQueue: Starting org.test.myapp consumerDisconnect

01-02 00:14:52.242 240 240 I BufferQueue: Starting org.test.myapp ~BufferQueue

01-02 00:14:52.251 26892 26921 I python : ImportError: dlopen failed: "/data/data/org.test.myapp/files/app/_applibs/numpy/core/multiarray.so" not 32-bit: 2

01-02 00:14:52.542 861 881 I WindowManager: Losing focus: Window{448d7c70 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-02 00:14:52.642 240 911 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity disconnect: api=1

01-02 00:14:52.642 240 911 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity getReleasedBuffers: returning mask 0xffffffff

01-02 00:14:52.750 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity consumerDisconnect

01-02 00:14:52.751 240 240 I BufferQueue: org.test.myapp/org.kivy.android.PythonActivity ~BufferQueue

Please can someone help thanks:)

Copied from original issue: kivy/kivy#4866

dessant commented 7 years ago

From @FeralBytes on January 4, 2017 15:12

Looks like your error has nothing to do with the Window; but rather a bad import; see here:

01-02 00:12:59.853 26524 26551 I python : ImportError: dlopen failed: "/data/data/org.test.myapp/files/app/_applibs/numpy/core/multiarray.so" not 32-bit: 2
dessant commented 7 years ago

From @Terrydaktal on January 5, 2017 22:1

@FeralBytes, after removing multiarray.so, the import error no longer appears, the removeview error remains however, the app still crashes

dessant commented 7 years ago

From @FeralBytes on January 6, 2017 4:7

That error may have something to do with the Splash screen; if I am reading the Java exception correctly; can you try again from Kivy latest via github and ensure the error still occurs. Also can you share a slimed down version of your code that crashes?

dessant commented 7 years ago

From @Terrydaktal on January 7, 2017 22:51

@FeralBytes I have tried it with latest kivy, latest buildozer, I have switched round the buildozer.spec so many times but the.apk still crashes on launch with that error.

It's not a very long code so here :

Code:

# -----------------main.py--------------------

# module level import block
import os
import random
import matplotlib.pyplot as plt
from seaborn import set, despine
from kivy import require
from string import ascii_letters
from PIL import Image
from math import ceil
from time import time
from timeout_decorator import timeout
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.button import Button
from kivy.properties import BooleanProperty
from kivy.properties import ObjectProperty
from sympy import *
from sympy.abc import *
from sympy.parsing.sympy_parser import parse_expr, standard_transformations, implicit_multiplication_application, convert_xor
from matplotlib import rcParams

# module config
set(style='ticks')
require('1.9.1')

# globals
itera = 0
Error = False
wrt = 'dx'
tt = 15
axesscope = 20

# object properties
outpexpr, inpexpr, main, history, setting, one, two, three, differentiatebutton, integratebutton = (ObjectProperty(None),) * 10

# functions
# renders an input to latex and saves as input path
def render(expr, path):
    rcParams['text.usetex'] = True if 'begin' in expr or Error is True else False
    rcParams['text.latex.unicode'] = True if 'begin' in expr or Error is True else False
    rcParams['text.latex.preamble'] = r'\usepackage{amsmath}' if 'begin' in expr or Error is True else r'\usepackage{unicode-math}'

    fig = plt.figure()
    ax = plt.axes([0, 0, 1, 1])
    r = fig.canvas.get_renderer()
    print(expr)  # testloc
    t = ax.text(0.5, 0.5, r'${}$'.format(expr), fontsize=50, fontweight='bold', color='white',
                horizontalalignment='center', verticalalignment='center')
    bb = t.get_window_extent(renderer=r)
    w, h = bb.width / fig.dpi, ceil(bb.height / fig.dpi)
    fig.set_size_inches((0.1 + w, 0.1 + h))  # if 'begin' in expr or w < 30 else 12))
    fig.set_facecolor('#000000')
    plt.xlim([0, 1])
    plt.ylim([0, 1])
    ax.grid(False)
    ax.set_axis_off()
    plt.savefig(path, facecolor=fig.get_facecolor())
    plt.clf()

    w, h = pillow(path, 1)
    print(w)  # testloc

    if w > 8000:
        raise Exception('oversized')

    clear()

# plots the graph based on last inputted expression
def plot():
    global axesscope
    axesscope = int(axesscope)
    path = generatepath()

    e = str(parse(access(1, 'raw.txt')))
    l = []
    k = [i for i in xfrange(-(axesscope), axesscope, 0.1)]
    y = list(map(lambda x: trymap(x, e), k))

    for j in y:
        try:
            int(j)
            l.append(j)
        except Exception:
            k[y.index(j)] = 'NaN'
            continue

    k = list(filter(('NaN').__ne__, k))

    while len(k) != len(l):
        if len(k) > len(l):
            k.pop()
        else:
            l.pop()

    print(k)  # testloc
    print(l)  # testloc

    fig, ax = plt.subplots()
    fig.set_size_inches(8, 8)

    try:
        assert k != []
        assert l != [0]
        ax.plot(k, l)

    except Exception as ex:
        print(ex)
        ax.grid(False)
        ax.set_axis_off()
        plt.title(r'Expression Unplottable', fontsize=40, y=1.025)

    else:
        plt.xlim(-(axesscope), axesscope)
        plt.ylim(-(axesscope), axesscope)
        ax.grid(True)
        ax.set_aspect('equal')
        despine(ax=ax, offset=-224)
        plt.title(r'${}$'.format(latex(parse(access(1, 'raw.txt')))), fontsize=40, y=1.025)

    finally:
        plt.savefig(path)
        plt.clf()
        return path

# parses standard mathematical input syntactically to python syntax
def parse(i):
    parsed = parse_expr(i, transformations=(
        standard_transformations + (convert_xor, implicit_multiplication_application,)))
    return parsed

# generate path for .png outputs with random string nomenclature
def generatepath():
    randpath = ''.join(random.sample(ascii_letters * 6, 6)) + '.png'
    return randpath

# adds the appropriate notation encapsulation for integration
def integration(expr, comp):
    comp = r"\equiv " + str(comp) + "+ C"
    expr = r"\int  " + str(expr) + r" \ " + wrt
    return expr, comp

# adds the appropriate notation encapsulation for differentiation
def differentiation(expr, comp):
    expr = r"\frac{d}{" + wrt + "}\ " + str(expr)
    comp = r"\equiv " + str(comp)
    return expr, comp

# commits calculations to save file
def commit(expr, rawexpr):
    with open('save.txt', 'a') as save:
        save.write(str(expr))
        save.write('\n')
    with open('raw.txt', 'a') as save:
        save.write(str(rawexpr))
        save.write('\n')
    print(expr)  # testloc

# access file, returns contents of the (parameter value) line from the end
def access(x, file):
    with open(file) as save:
        lines = save.readlines()
        outp = lines[-x].rstrip()
    return outp

# increments the global for history page, cycles 3 at a time
def increment(x):
    global itera
    itera += x

# adjusts GUI image area to image dimensions, keeps good ratio
def pillow(path, scale):
    w, h = Image.open(path).size
    f = lambda i, j: (i * scale, j * scale)
    return f(w, h)

# returns a generator to fill the plot array
def xfrange(start, stop, step):
    i = 0
    while start + i * step < stop:
        yield start + i * step
        i += 1

#attempts to map values to new list through lambda of imput
def trymap(x, e):
    e = e.replace(wrt.replace('d', ''), 'x')
    f = lambda i: eval(e)
    try:
        f(x)
        return eval(e)
    except Exception:
        return 'NaN'

#calculates and formats the input and output with correct notation, with timeout decorator
@timeout(tt, use_signals=True)
def formatinp(calculation, mode):
    return integration(latex(parse(calculation)), latex(integrate(parse(calculation), Symbol(wrt.replace('d', ''))))) \
        if mode == 'itgr' \
        else differentiation(latex(parse(calculation)), latex(diff(parse(calculation), Symbol(wrt.replace('d', '')))))

#cleans out working directory, removing clutter .pngs created more than 20 seconds from system time
def clear():
    try:
        files = os.listdir(".")
        for f in files:
            if os.path.isfile(f):
                t = os.stat(f)

                if t.st_ctime < time() - 20 and f.endswith('.png'):
                    os.remove(f)

    except Exception:
        pass

# Main screen class
class MainScreen(Screen, GridLayout):
    def calculate(self, calculation, mode):
        global Error
        self.helix = generatepath()
        self.cyndy = generatepath()
        if calculation != '':
            calculation = calculation.replace('e', 'E')

            try:
                latexexpr, self.computeexpr = formatinp(calculation, mode)
                render(latexexpr, self.cyndy)
                commit(latexexpr, calculation)

            except Exception as e:
                print('hi')
                Error = True

                if 'oversized' in str(e.args):
                    print('yes')
                    render(r'\text{Image too large to render}\ ', self.cyndy)
                else:
                    render(r'\text{Timeout}\ ' if str(e) == repr('Timed Out') else r'\text{Syntax Error}\ ', self.cyndy)

        else:
            Error = True
            render(r'\text{Syntax Error}\ ', self.cyndy)
        return self.cyndy

    def displ(self):
        global Error
        if Error is False:
            try:
                if r'\int' in self.computeexpr:
                    Error = True
                    render(r'\text{Integral does not compute}\ ', self.helix)
                    Error = False
                else:
                    render(self.computeexpr, self.helix)
            except Exception:
                Error = True
                render(r'\text{Nothing to show}\ ', self.helix)
                Error = False

        else:
            render(r'\text{Nothing to show}\ ', self.helix)
            Error = False
        return self.helix

    def remaster(self, dt):
        global outpexpr, inpexpr, differentiatebutton, integratebutton
        self.inpexpr.width, self.inpexpr.height = pillow(self.cyndy, 0.70)
        self.outpexpr.width, self.outpexpr.height = pillow(self.helix, 0.70)
        self.inpexpr.opacity, self.outpexpr.opacity = 1, 1
        self.differentiatebutton.enabled = True
        self.integratebutton.enabled = True
        print('twice')

    def graphpopupopen(self):
        GraphPopupClass().open()

# History screen class
class HistScreen(Screen, GridLayout):
    def retrieval(self, n, inptyp):
        global Error, itera, one, two, three
        path = generatepath()
        try:
            render(str(access(itera + n, 'save.txt')), path)
        except Exception:
            Error = True
            render(r'\text{no further item}\ ', path)
            Error = False
        if inptyp == 'one':
            print('one')
            self.one.width, self.one.height = pillow(path, 0.70)

        elif inptyp == 'two':
            print('two')
            self.two.width, self.two.height = pillow(path, 0.70)
        else:
            print('three')
            self.three.width, self.three.height = pillow(path, 0.70)
        return path

    def recompute(self, n):
        global itera, outpexpr, inpexpr, wrt, Error, differentiatebutton, integratebutton
        self.parent.ids.main.differentiatebutton.enabled = False
        self.parent.ids.main.integratebutton.enabled = False
        outpath = generatepath()
        inpath = generatepath()
        oldwrt = wrt
        rawline = access(itera + n, 'raw.txt')
        line = access(itera + n, 'save.txt')

        wrt = line[-2:] if 'int' in line else line[9:11]
        expr, comp = formatinp(rawline, 'itgr' if 'int' in line else 'diff')
        render(expr, inpath)

        if r'\int' in comp:
            Error = True
            render(r'\text{Integral does not compute}\ ', outpath)
            Error = False
        else:
            render(comp, outpath)

        wrt = oldwrt

        self.parent.ids.main.inpexpr.source = inpath
        self.parent.ids.main.outpexpr.source = outpath
        self.parent.ids.main.inpexpr.width, self.parent.ids.main.inpexpr.height = pillow(inpath, 0.70)
        self.parent.ids.main.outpexpr.width, self.parent.ids.main.outpexpr.height = pillow(outpath, 0.70)
        self.parent.ids.main.inpexpr.opacity, self.parent.ids.main.outpexpr.opacity = 1, 1
        self.parent.ids.main.differentiatebutton.enabled = True
        self.parent.ids.main.integratebutton.enabled = True

# Popup for graph class
class GraphPopupClass(Popup):
    def getsource(self):
        return plot()

# Popup for clear history class
class ClearPopupClass(Popup):
    pass

# Settings screen class
class SettingsScreen(Screen, GridLayout):
    def wrt(self, inp):
        if inp:
            global wrt
            wrt = "d" + inp

    def tt(self, inp):
        if inp:
            global tt
            tt = inp

    def axesscope(self, inp):
        if inp:
            global axesscope
            axesscope = inp

    def clearpopupopen(self):
        ClearPopupClass().open()

# Deactivatable button class
class DeactivatableButton(Button):
    enabled = BooleanProperty(True)

    def on_enabled(self, instance, value):
        if value:
            self.background_color = [1, 1, 1, 1]
            self.color = [1, 1, 1, 1]
        else:
            self.background_color = [1, 1, 1, .3]
            self.color = [1, 1, 1, .5]

    def on_touch_down(self, touch):
        if self.enabled:
            return super(self.__class__, self).on_touch_down(touch)

# Window manager class
class Manager(ScreenManager):
    global main, history, setting

# Build class
class CalculatorApp(App):
    def build(self):
        # config screen manager
        sm = Manager()
        return sm

    def clearhist(self):
        open('save.txt', 'w').close()
        open('raw.txt', 'w').close()

    def incritera(self, i):
        global itera
        increment(i)
        itera = 0 if itera < 0 or i is False else itera

    def getenabled(self):
        return True if itera > 0 else False

if __name__ == '__main__':
    calcApp = CalculatorApp()
    calcApp.run()

Kivy file:

# -------------- calculator.kv  -----------------
#:import Clock kivy.clock.Clock

<CustButton@Button>:
    font_size: 25
    size_hint_y: None
    height: 50

<DeactivatableButton@Button>:
    font_size: 25
    size_hint_y: None
    height: 50

<MainScreen>:
    id: main
    inpexpr: inpexpr
    outpexpr: outpexpr
    display: entry
    differentiatebutton: differentiatebutton
    integratebutton: integratebutton
    AnchorLayout:
        GridLayout:
            rows: 4
            row_default_height: 50
            padding: 10
            spacing: 10
            anchor_y: 'top'
            TextInput:
                id: entry
                size_hint_y: None
                height: 50
                font_size: 32
                multiline: False
            BoxLayout:
                size_hint_y: None
                height: 50
                cols: 2
                row_force_default: True
                row_default_height: 40
                spacing: 10

                DeactivatableButton:
                    id: differentiatebutton
                    text: "Differentiate"
                    #on_press: inpexpr.source = 'buffer.gif'
                    #on_press: outpexpr.source = 'buffer.gif'
                    on_press: outpexpr.opacity = 0
                    on_press: inpexpr.opacity = 0
                    on_press: differentiatebutton.enabled = False
                    on_press: integratebutton.enabled = False
                    on_press: inpexpr.source = root.calculate(entry.text, "diffr")
                    on_release: outpexpr.source = root.displ()
                    on_release: Clock.schedule_once(root.remaster, 0.1)
                    on_release: deactivatablebutton.enabled = True

                DeactivatableButton:
                    id: integratebutton
                    text: "Integrate"
                    #on_press: inpexpr.source = 'buffer.gif'
                    #on_press: outpexpr.source = 'buffer.gif'
                    on_press: outpexpr.opacity = 0
                    on_press: inpexpr.opacity = 0
                    on_press: differentiatebutton.enabled = False
                    on_press: integratebutton.enabled = False
                    on_press: inpexpr.source = root.calculate(entry.text, "itgr")
                    on_release: outpexpr.source = root.displ()
                    on_release: Clock.schedule_once(root.remaster,0.1)
                    on_release: deactivatablebutton.enabled = True

            ScrollView:
                GridLayout:
                    cols: 1
                    size_hint_x: None
                    width: self.minimum_width
                    Image:
                        id: inpexpr
                        opacity: 0
                        size_hint_x: None
                        size_hint_y: None
                        #width: 120*(3/4)
                        #height: 200

            ScrollView:
                GridLayout:
                    cols: 1
                    size_hint_x: None
                    width: self.minimum_width
                    Image:
                        id: outpexpr
                        opacity: 0
                        size_hint_x: None
                        size_hint_y: None
                        #width: 3000
                        #height: 200

        BoxLayout:
            cols: 4
            row_force_default: True
            row_default_height: 40
            spacing: 10
            anchor_y: 'bottom'

            CustButton:
                text: 'History'
                on_press: root.manager.current = 'histscr'
                on_press: root.manager.transition.direction = 'right'

            CustButton:
                text: "Clear"
                on_press: entry.text = ""
                on_press: inpexpr.opacity = 0
                on_press: outpexpr.opacity = 0

            DeactivatableButton:
                id: deactivatablebutton
                text: "Graph"
                enabled: False
                on_press: root.graphpopupopen()

            CustButton:
                text: 'Settings'
                on_press: root.manager.current = 'settingscr'
                on_press: root.manager.transition.direction = 'left'
<HistScreen>:
    one:one
    two:two
    three:three
    AnchorLayout:
        id: history
        GridLayout:
            rows: 4
            padding: 10
            spacing: 10
            BoxLayout:
                size_hint_y: None
                height: 50
                cols: 4
                row_force_default: True
                row_default_height: 40
                spacing: 1
                anchor_y: 'top'
                row_force_default: True
                CustButton:
                    text: 'go back'
                    on_press: root.manager.current = 'mainscr'
                    on_press: root.manager.transition.direction = 'left'
                    on_release: mostrec.enabled = True
                    on_release: prev.enabled = False
                    on_release: retrieval.opacity = 0
                    on_release: retrieval1.opacity = 0
                    on_release: retrieval2.opacity = 0

                CustButton:
                    id: more
                    text: 'load more'
                    on_press: app.incritera(3)
                    on_release: one.source = root.retrieval(1, 'one')
                    on_release: one.opacity = 1
                    on_release: retrieval.opacity = 1
                    on_release: two.source = root.retrieval(2, 'two')
                    on_release: two.opacity = 1
                    on_release: retrieval1.opacity = 1
                    on_release: three.source = root.retrieval(3, 'three')
                    on_release: three.opacity = 1
                    on_release: retrieval2.opacity = 1
                    on_release: prev.enabled = app.getenabled()
                    on_release: mostrec.enabled = True

                DeactivatableButton:
                    id: prev
                    enabled: False
                    text: 'load previous'
                    on_press: app.incritera(-3)
                    on_release: one.source = root.retrieval(1, 'one')
                    on_release: one.opacity = 1
                    on_release: retrieval.opacity = 1
                    on_release: two.source = root.retrieval(2, 'two')
                    on_release: two.opacity = 1
                    on_release: retrieval1.opacity = 1
                    on_release: three.source = root.retrieval(3, 'three')
                    on_release: three.opacity = 1
                    on_release: retrieval2.opacity = 1
                    on_release: prev.enabled = app.getenabled()
                    on_release: mostrec.enabled = app.getenabled()

                DeactivatableButton:
                    id: mostrec
                    enabled: True
                    text: 'most recent'
                    on_press: app.incritera(False)
                    on_release: one.source = root.retrieval(1, 'one')
                    on_release: one.opacity = 1
                    on_release: retrieval.opacity = 1
                    on_release: two.source = root.retrieval(2, 'two')
                    on_release: two.opacity = 1
                    on_release: retrieval1.opacity = 1
                    on_release: three.source = root.retrieval(3, 'three')
                    on_release: three.opacity = 1
                    on_release: retrieval2.opacity = 1
                    on_release: prev.enabled = False
                    on_release: mostrec.enabled = False

            GridLayout:
                id: retrieval
                opacity: 0
                width: self.minimum_width
                cols: 2
                ScrollView:
                    Image:
                        id: one
                        opacity: 0
                        size_hint_x: None

                CustButton:
                    text: 'recompute'
                    size_hint_x: None
                    width: 130
                    on_press: root.manager.current = 'mainscr'
                    on_press: root.manager.transition.direction = 'left'
                    on_press: root.recompute(1)
                    on_release: mostrec.enabled = True
                    on_release: prev.enabled = False
                    on_release: retrieval.opacity = 0
                    on_release: retrieval1.opacity = 0
                    on_release: retrieval2.opacity = 0

            GridLayout:
                id: retrieval1
                opacity: 0
                width: self.minimum_width
                cols: 2
                ScrollView:
                    Image:
                        id: two
                        opacity: 0
                        size_hint_x: None

                CustButton:
                    text: 'recompute'
                    size_hint_x: None
                    width: 130
                    on_press: root.manager.current = 'mainscr'
                    on_press: root.manager.transition.direction = 'left'
                    on_press: root.recompute(2)
                    on_release: mostrec.enabled = True
                    on_release: prev.enabled = False
                    on_release: retrieval.opacity = 0
                    on_release: retrieval1.opacity = 0
                    on_release: retrieval2.opacity = 0

            GridLayout:
                id: retrieval2
                opacity: 0
                width: self.minimum_width
                cols: 2
                ScrollView:
                    Image:
                        id: three
                        opacity: 0
                        size_hint_x: None

                CustButton:
                    text: 'recompute'
                    size_hint_x: None
                    width: 130
                    on_press: root.manager.current = 'mainscr'
                    on_press: root.manager.transition.direction = 'left'
                    on_press: root.recompute(3)
                    on_release: mostrec.enabled = True
                    on_release: prev.enabled = False
                    on_release: retrieval.opacity = 0
                    on_release: retrieval1.opacity = 0
                    on_release: retrieval2.opacity = 0

<SettingsScreen>:
    id: setting
    AnchorLayout
        GridLayout:
            rows: 3
            padding: 10
            spacing: 1
            anchor_y: 'top'
            GridLayout:
                cols:2
                rows:4
                Label:
                    text: 'Timout time, default: 15'

                TextInput:
                    id: tt
                    size_hint_y: None
                    height: 50
                    font_size: 32
                    multiline: False
                    on_text_validate: root.tt(self.text)

                Label:
                    text: 'Axes extent, default: 20'

                TextInput:
                    id: axesscope
                    size_hint_y: None
                    height: 50
                    font_size: 32
                    multiline: False
                    on_text_validate: root.axesscope(self.text)

                Label:
                    text: 'Global wrt variable, default: x'

                TextInput:
                    id: wrt
                    size_hint_y: None
                    height: 50
                    font_size: 32
                    multiline: False
                    on_text_validate: root.wrt(self.text)

                Label:
                    text: 'Clear history'

                CustButton:
                    text: 'Clear'
                    on_press: root.clearpopupopen()

            CustButton:
                text: 'return'
                on_press: root.manager.current = 'mainscr'
                on_press: root.manager.transition.direction = 'right'

<ClearPopupClass>:
    id: clearpopup
    title: 'Warning'
    auto_dismiss: False
    size_hint_y: None
    size_hint_x: None
    height: 250
    width: 300

    BoxLayout:
        id: contentbox
        orientation: "vertical"
        rows: 2

        ScrollView:
            size_hint_y: None
            height: 146
            Label:
                id: content_text
                size_hint_y: None
                height: self.texture_size[1]
                text: 'Calculations are stored in plain text form, making the application easier to manage, clearing the history will not clear space, do you really want to clear'
                text_size: (self.width-20), None
                line_height: 1.5
                valign: "middle"

        BoxLayout:
            cols: 2
            rows: 1
            Button:
                text: "Yes"
                size_hint_y: None
                height: "40dp"
                on_press: app.clearhist()

            Button:
                text: "No"
                size_hint_y: None
                height: "40dp"
                on_press: root.dismiss()

<GraphPopupClass>:
    id: graphpopup
    title: 'Plot'
    auto_dismiss: False
    size_hint_y: None
    size_hint_x: None
    height: 600
    width: 525
    GridLayout:
        rows: 2

        Image:
            id: graphplot
            source: root.getsource()

        Button:
            text: "Go back"
            size_hint_y: None
            height: "40dp"
            on_press: root.dismiss()

<Manager>:
    id: screen_manager

    main: main
    history: history
    setting: setting

    MainScreen:
        id: main
        name: 'mainscr'
        manager: screen_manager

    HistScreen:
        id: history
        name: 'histscr'
        manager: screen_manager

    SettingsScreen:
        id: setting
        name: 'settingscr'
dessant commented 7 years ago

From @Terrydaktal on January 7, 2017 22:53

If someone could get a working apk out of this I would really appreciate it.

dessant commented 7 years ago

From @FeralBytes on January 16, 2017 10:43

@Terrydaktal please post a new log output now that you have removed the "multiarray.so".

dessant commented 7 years ago

This looks like either an user error, or an issue with the numpy recipe, moving to p4a.

Terrydaktal commented 7 years ago

@dessant IIRC the log was exactly the same but with the multiarray.so mention gone. When I get home later I'm going to try and compile the apk on a new machine, and see if it works then.

FeralBytes commented 7 years ago

needs awaiting reply tag @Terrydaktal how did the compile go?

Terrydaktal commented 7 years ago

Still the same error on the new machine, this simply does not compile with any ndk or any sdk version for Android api 19, it crashes with that same error on launch

FeralBytes commented 7 years ago

@Terrydaktal still need that new log verbatim copied to github; the one without the multiarray.so so that we can look through it. If it makes you feel any better; I too am not able to get any apps working right now.

Terrydaktal commented 7 years ago

I don't think removing multiarray.so is the best solution, I think any consequent issues that will arise will be because of multiarray.so being missing, as opposed to multiarray.so being present but' not 32 bit',

When opening the original app built for api 19, ndk r13b, Android new, sdk 25.2 I think it is, on another phone with Android 6 the same error is produced before multiarray.so is removed.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/lithium/lithium:6.0.1/MXB48T/V8.0.12.0.MAHCNDI:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 1888, tid: 1929, name: SDLThread  >>> org.test.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1
    r0 ea5c35f8  r1 00000000  r2 00000000  r3 00000001
    r4 00000001  r5 ded7f430  r6 00000000  r7 ea5c35f8
    r8 ea5c35f0  r9 000000f6  sl ef1d6a44  fp ea5c35f0
    ip 80000000  sp dfc69520  lr de26f6e9  pc de26d418  cpsr 20010030

backtrace:
    #00 pc 000b0418  /data/data/org.test.myapp/files/app/lib/python2.7/site-packages/numpy/core/multiarray.so
    #01 pc 000b26e5  /data/data/org.test.myapp/files/app/lib/python2.7/site-packages/numpy/core/multiarray.so

In fact here's the logcat on the Android 4.4.4 device when using python3crystax and crystax ndk instead and android_new, sdk25.2,

01-22 00:26:02.824  1936  1936 I cm.log.servpro: [DR_mon][D]/ 43250243 : :org.test.myapp:Calcapp:70580813)/storage/emulated/0/Telegram/Telegram Documents/4_5774155699189711094.apk

01-22 00:26:04.269   863  1067 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.test.myapp cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 23153

01-22 00:26:04.496   240   240 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:0,p:-1,c:240) setConsumerName: Starting org.test.myapp

01-22 00:26:04.496   240   240 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:0,p:-1,c:240) setDefaultBufferSize: w=1, h=1

01-22 00:26:04.512   240   240 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:0,p:-1,c:240) setDefaultBufferSize: w=1080, h=1920

01-22 00:26:04.525   863   881 I ActivityManager: Start proc org.test.myapp for activity org.test.myapp/org.kivy.android.PythonActivity: pid=24742 uid=10108 gids={50108, 1028, 1015, 1023}

01-22 00:26:04.538   240  1452 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:863,c:240) connect: api=2 producer=(863:system_server) producerControlledByApp=false

01-22 00:26:04.539   240   482 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:863,c:240) new GraphicBuffer needed

01-22 00:26:14.289   863   883 E WindowManager: Starting window AppWindowToken{4459eb18 token=Token{4409d440 ActivityRecord{43de1fc8 u0 org.test.myapp/org.kivy.android.PythonActivity t24}}} timed out

01-22 00:26:14.291   240   484 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:-1,c:240) disconnect: api=2

01-22 00:26:14.291   240   484 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:-1,c:240) getReleasedBuffers: returning mask 0xffffffff

01-22 00:26:14.298   240   240 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:-1,c:-1) consumerDisconnect

01-22 00:26:14.298   240   240 I BufferQueue: [Starting org.test.myapp](this:0xb7727b08,id:263,api:2,p:-1,c:-1) ~BufferQueue

01-22 00:26:28.866 24742 24742 E dalvikvm: dlopen("/data/app-lib/org.test.myapp-2/libpython2.7.so") failed: dlopen failed: could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by cannot locate symbol "signal" referenced by "libssl1.0.2h.so"...

01-22 00:26:28.905 24742 24742 E dalvikvm: dlopen("/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/_io.so") failed: dlopen failed: library "/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/_io.so" not found

01-22 00:26:28.906 24742 24742 E dalvikvm: dlopen("/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/_ctypes.so") failed: dlopen failed: library "/data/data/org.test.myapp/files/app/lib/python2.7/lib-dynload/_ctypes.so" not found

01-22 00:26:29.711   240   240 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:0,p:-1,c:240) setConsumerName: org.test.myapp/org.kivy.android.PythonActivity

01-22 00:26:29.711   240   240 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:0,p:-1,c:240) setDefaultBufferSize: w=1, h=1

01-22 00:26:29.736   240   240 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:0,p:-1,c:240) setDefaultBufferSize: w=1080, h=1920

01-22 00:26:29.738   863   883 I WindowManager: Gaining focus: Window{43e1ce60 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-22 00:26:29.750   240   484 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:24742,c:240) connect: api=1 producer=(24742:org.test.myapp) producerControlledByApp=true

01-22 00:26:29.750   240  1452 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:24742,c:240) new GraphicBuffer needed

01-22 00:26:29.838 24742 24776 I python  : /data/data/org.test.myapp/files/app

01-22 00:26:29.844 24742 24776 I python  : /data/data/org.test.myapp/files/app/crystax_python/stdlib.zip:/data/data/org.test.myapp/files/app/crystax_python/modules

01-22 00:26:29.898   240   484 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:24742,c:240) new GraphicBuffer needed

01-22 00:26:29.918   863   883 I ActivityManager: [AppLaunch] Displayed Displayed org.test.myapp/org.kivy.android.PythonActivity: +25s403ms

01-22 00:26:29.923   240   482 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:24742,c:240) new GraphicBuffer needed

01-22 00:26:30.169 24742 24776 I python  : Android path ['.', '/data/data/org.test.myapp/files/app/crystax_python/stdlib.zip', '/data/data/org.test.myapp/files/app/crystax_python/modules', '/data/data/org.test.myapp/files/app/crystax_python/site-packages']

01-22 00:26:30.170 24742 24776 I python  : os.environ is environ({'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'ANDROID_STORAGE': '/storage', 'ASEC_MOUNTPOINT': '/mnt/asec', 'USBOTG_STORAGE': '/storage/usbotg', 'BOOTCLASSPATH_EX': '/system/framework/mediatek-op.jar', 'LD_PRELOAD': '/system/lib/libpldbgutil.so', 'ANDROID_ASSETS': '/system/app', 'PYTHONHOME': '/data/data/org.test.myapp/files/app', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'LOOP_MOUNTPOINT': '/mnt/obb', 'CLASSPATH': '/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar', 'PYTHONOPTIMIZE': '2', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'PYTHONPATH': '/data/data/org.test.myapp/files/app:/data/data/org.test.myapp/files/app/lib', 'ANDROID_PROPERTY_WORKSPACE': '9,0', 'ANDROID_ARGUMENT': '/data/data/org.test.myapp/files/app', 'ANDROID_DATA': '/data', 'LD_LIBRARY_PATH': '/vendor/lib:/system/lib:/custom/lib', 'ANDROID_PRIVATE': '/data/data/org.test.myapp/files', 'ANDROID_APP_PATH': '/data/data/org.test.myapp/files/app', 'PYTHON_NAME': 'python', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'BOOTCLASSPATH': '/system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/webviewchromium.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/CustomProperties.jar:/system/framework/mediatek-telephony-common.jar:/system/framework/mediatek-tablet.jar:/system/framework/dolby_ds.jar', 'ANDROID_SOCKET_zygote': '10', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'ANDROID_ENTRYPOINT': 'main.pyo'})

01-22 00:26:30.787   863   883 I WindowManager: Losing focus: Window{43e1ce60 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-22 00:26:30.980   240  1452 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:-1,c:240) disconnect: api=1

01-22 00:26:30.980   240  1452 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:-1,c:240) getReleasedBuffers: returning mask 0xffffffff

01-22 00:26:31.188   240   240 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:-1,c:-1) consumerDisconnect

01-22 00:26:31.189   240   240 I BufferQueue: [org.test.myapp/org.kivy.android.PythonActivity](this:0xb76981c8,id:264,api:1,p:-1,c:-1) ~BufferQueue

01-22 00:26:31.360   863  3650 I WindowState: WIN DEATH: Window{43e1ce60 u0 org.test.myapp/org.kivy.android.PythonActivity}

01-22 00:26:31.361   863  1147 I ActivityManager: Process org.test.myapp (pid 24742) has died.

01-22 00:26:31.361   863  3650 W WindowManager: Force-removing child win Window{43e63158 u0 SurfaceView} from container Window{43e1ce60 u0 org.test.myapp/org.kivy.android.PythonActivity

And lastly, here's the error after removing multiarray.so on the original target android 4.4.4 device when using ndk r13b and android_new

---- 29 Jan 2017 13:35:01 ----

01-29 13:33:21.458   864  1161 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 1303

01-29 13:33:21.477   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:0,p:-1,c:239) setConsumerName: Starting org.test.myapp

01-29 13:33:21.477   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:0,p:-1,c:239) setDefaultBufferSize: w=1, h=1

01-29 13:33:21.482   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:0,p:-1,c:239) setDefaultBufferSize: w=1080, h=1920

01-29 13:33:21.496  8573  8573 W System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

01-29 13:33:21.501  8573  8573 E AndroidRuntime: Process: org.test.myapp, PID: 8573

01-29 13:33:21.501  8573  8573 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

01-29 13:33:21.516   239   506 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:864,c:239) connect: api=2 producer=(864:system_server) producerControlledByApp=false

01-29 13:33:21.516   239   913 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:864,c:239) new GraphicBuffer needed

01-29 13:33:21.539   864  4130 W ActivityManager:   Force finishing activity org.test.myapp/org.kivy.android.PythonActivity

01-29 13:33:21.952  9405  9405 I DEBUG   : [OnPurpose Redunant in preset_info] pid: 8573, tid: -1361051648, name: UNKNOWN  >>> org.test.myapp <<<

01-29 13:33:22.145   864   887 I WindowManager: Gaining focus: Window{43cfbe60 u0 Application Error: org.test.myapp}

01-29 13:33:22.155   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:0,p:-1,c:239) setConsumerName: Application Error: org.test.myapp

01-29 13:33:22.155   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:0,p:-1,c:239) setDefaultBufferSize: w=1, h=1

01-29 13:33:22.161   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:0,p:-1,c:239) setDefaultBufferSize: w=940, h=362

01-29 13:33:22.180   239  1451 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) connect: api=2 producer=(864:system_server) producerControlledByApp=false

01-29 13:33:22.180   239   913 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) new GraphicBuffer needed

01-29 13:33:22.417   864   891 W ActivityManager: Activity pause timeout for ActivityRecord{43cde7b0 u0 org.test.myapp/org.kivy.android.PythonActivity t6 f}

01-29 13:33:23.145   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) new GraphicBuffer needed

01-29 13:33:23.365   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) new GraphicBuffer needed

01-29 13:33:23.369   239   506 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) queueBuffer: fps=1.69 dur=1181.93 max=961.32 min=220.61

01-29 13:33:23.382   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:864,c:239) new GraphicBuffer needed

01-29 13:33:23.749   864   887 I WindowManager: Losing focus: Window{43cfbe60 u0 Application Error: org.test.myapp EXITING}

01-29 13:33:23.843   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:-1,c:239) disconnect: api=2

01-29 13:33:23.843   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:-1,c:239) getReleasedBuffers: returning mask 0xffffffff

01-29 13:33:23.857   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:-1,c:-1) consumerDisconnect

01-29 13:33:23.857   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb88455e8,id:43,api:2,p:-1,c:-1) ~BufferQueue

01-29 13:33:23.972   864  1047 I ActivityManager: Process org.test.myapp (pid 8573) has died.

01-29 13:33:23.975   239  1451 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:-1,c:239) disconnect: api=2

01-29 13:33:23.975   239  1451 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:-1,c:239) getReleasedBuffers: returning mask 0xffffffff

01-29 13:33:23.976   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:-1,c:-1) consumerDisconnect

01-29 13:33:23.976   239   913 I BufferQueue: [Starting org.test.myapp](this:0xb8827b30,id:42,api:2,p:-1,c:-1) ~BufferQueue

---- 29 Jan 2017 13:35:01 ----

As you can see the removeView error remains My next step is to remove multiarray from the app on the Android 6 device as that is the only traceback that is produced, I wonder what error it would then give.

FeralBytes commented 7 years ago

Are you building in debug mode or release mode because it seems like there should be more output than just this. Just for reference we are fighting similar issues but the output from our programs seems to be a little bit more verbose; the issue is here for reference: #992

Terrydaktal commented 7 years ago

sudo buildozer android_new debug serve is the exact command I use

FeralBytes commented 7 years ago

What is your OS, Python version, and you mention crystax; so what is your buildozer.spec for the crystax version and in the none crystax version what changes do you make? Thank you I know I am asking a lot; but I am currently shooting in the dark trying to gather as much information as possible to find out what is going wrong.

FeralBytes commented 7 years ago

@Terrydaktal so you are serving the file via http and then downloading it to your device? Are you then running adb logcat to get the output that you pasted; just making sure I am following your work flow? Also what happens if you remove numpy as a requirement?

Terrydaktal commented 7 years ago

I currently don't have access to my home computer today so It is difficult to answer, I do however have python 3.5.2 as its stable, on my new VM im running latest Ubuntu, I'm compiling using Android sdk 25.2.5, ndk r13b, for Android api 19.(I am unable to compile for higher than this due to errors upon compiling that I couldn't get around, but thats irrelevant right now). I have tried multiple different requirement combinations to my knowledge and I've tried crystax as well, when the multiarray.so error doesn't appear the removeview error does appear (this appears to be the main error), at some point I'm going to have to compile my app feature by feature to see what block of code it is actually having issue with. There's some issue with Android_new that produces this removeview error, compiling with Android alone did produce a simple app, for my project however it produces missing.so files which are fixed by using the new toolchain. The main error does appear to be this removeview error, I've seen it multiple times, it also happened before I realized I forgot to include numpy in the requirements. BTW, something that's always made me scratch my head is the fact the apk only has lib/python2.7, is this normal that all the modules are for python 2.7..? I did code in 3.5.2.

And yes, I serve the file and then transfer it to the device. However, when I did deploy and run it, it still had the same errors, and yes the log is from logcat after it crashes.

If you want to play about with it, here is the latest version of the project:

https://www.dropbox.com/s/0trxkojsi4ydhyv/Project.zip?dl=0

FeralBytes commented 7 years ago

Well; I too am currently in a bit of a catch 22; as I would prefer to use python-osc over kivy's osc (kivy osc has been broken many times especially with py3). But currently I can not get Crystax type builds to work. My builds are crashing on launch as described in the other issue. Going back to Android_New means replacing python-osc with kivy-osc, not a big deal but I think those builds are failing for me; i will try soon and confirm. As for the APK; how do you know it is py2.7? Are you talking in the archive: /lib/armeabi-v7a/ directory, if I build with Crystax there I find: libpython3.5m.so.

Terrydaktal commented 7 years ago

im talking about private.mp3/lib/python2.7 or after apk install data/data/org.test.app/files/lib/python2.7 - all of the libraries being used are 2.7, there are no 3.5 libraries with the apk. Is this right... I think im going to try to compile with just android again and then put in all of the missing .so files from the android_new compiled apk and then see if i get anywhere.

FeralBytes commented 7 years ago

OK, hopefully this does not seem too dumb. But how are you seeing the contents of private.mp3, I tried opening it with Archive Manager but it failed. @Terrydaktal that is smart; but I think you will have to do something with re-aligning the JAR/APK; or at least I remember something about that.

Terrydaktal commented 7 years ago

Get the apk on windows, open winrar, open apk on winrar, extract private.mp3, change the default program to open.mp3 s to winrar, it opens.

Terrydaktal commented 7 years ago

Update: Updating buildozer to 0.33dev fixed some issues in the console which prevented me from compiling to API23. After compiling the apk for API 23 , ndk r13b, sdk 25.2.5, python 3.2.5, ubuntu 16.04 LTS, kivy 1.9.2 dev, latest p4a from repo, with the following buildozer.spec and the numpy error seemingly fixed:

# (str) Title of your application
title = Calcapp

# (str) Package name
package.name = myapp

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

# (str) Source code where the main.py live
source.dir = /home/lewis/project/

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

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (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 = 0.1

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

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy, kivy==master, sqlite3, openssl, numpy, tex, sympy, numpy, ws4py, seaborn, matplotlib, scipy 
#tex, sympy, numpy, matplotlib, ws4py, seaborn, scipy, 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 = all

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

#
# Android specific
#

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

# (list) Permissions
#android.permissions = INTERNET

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

# (int) Minimum API required
#android.minapi = 9

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

# (str) Android NDK version to use
android.ndk = 13b

# (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/lewis/Downloads/android-ndk-r13b
#android.ndk_path = /home/lewis/Downloads/android-ndk-r11c
#android.ndk_path = /home/lewis/Downloads/crystax-ndk-10.3.2

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

# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =

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

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

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False

# (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 =

# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D

# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1

#
# iOS specific
#

# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios

# (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

# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin

#    —---------------------------------------------------------------------------
#    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

I now get this error in the logcat when opening the .apk

---- 2 Feb 2017 22:48:54 ----

02-02 22:47:52.619   864  4127 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity} from pid 1303

02-02 22:47:52.655   864  1285 I ActivityManager: Start proc org.test.myapp for activity org.test.myapp/org.kivy.android.PythonActivity: pid=24142 uid=10108 gids={50108, 1028, 1015, 1023}

02-02 22:47:52.671   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:0,p:-1,c:239) setConsumerName: Starting org.test.myapp

02-02 22:47:52.671   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:0,p:-1,c:239) setDefaultBufferSize: w=1, h=1

02-02 22:47:52.676   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:0,p:-1,c:239) setDefaultBufferSize: w=1080, h=1920

02-02 22:47:52.718   239   503 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:864,c:239) connect: api=2 producer=(864:system_server) producerControlledByApp=false

02-02 22:47:52.719   239   913 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:864,c:239) new GraphicBuffer needed

02-02 22:47:52.974 24142 24142 W System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.NullPointerException

02-02 22:47:52.984 24142 24142 E AndroidRuntime: Process: org.test.myapp, PID: 24142

02-02 22:47:52.984 24142 24142 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.test.myapp/org.kivy.android.PythonActivity}: java.lang.NullPointerException

02-02 22:47:52.988   864  1289 W ActivityManager:   Force finishing activity org.test.myapp/org.kivy.android.PythonActivity

02-02 22:47:53.040 24157 24157 I DEBUG   : [OnPurpose Redunant in preset_info] pid: 24142, tid: -1361051648, name: UNKNOWN  >>> org.test.myapp <<<

02-02 22:47:53.289   864  1289 I WindowManager: Screenshot max retries 4 of Token{43835aa0 ActivityRecord{44696b30 u0 org.test.myapp/org.kivy.android.PythonActivity t59 f}} appWin=Window{4427cf18 u0 Starting org.test.myapp} drawState=4

02-02 22:47:53.317   864   887 I WindowManager: Gaining focus: Window{442f7318 u0 Application Error: org.test.myapp}

02-02 22:47:53.326   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:0,p:-1,c:239) setConsumerName: Application Error: org.test.myapp

02-02 22:47:53.326   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:0,p:-1,c:239) setDefaultBufferSize: w=1, h=1

02-02 22:47:53.337   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:0,p:-1,c:239) setDefaultBufferSize: w=940, h=362

02-02 22:47:53.346   239  9428 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:864,c:239) connect: api=2 producer=(864:system_server) producerControlledByApp=false

02-02 22:47:53.346   239   506 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:864,c:239) new GraphicBuffer needed

02-02 22:47:53.790   864   891 W ActivityManager: Activity pause timeout for ActivityRecord{44696b30 u0 org.test.myapp/org.kivy.android.PythonActivity t59 f}

02-02 22:47:54.321   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:864,c:239) new GraphicBuffer needed

02-02 22:47:54.491   239  1451 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:864,c:239) new GraphicBuffer needed

02-02 22:47:54.497   239   503 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:864,c:239) queueBuffer: fps=1.75 dur=1145.11 max=975.84 min=169.27

02-02 22:47:54.524   864   887 I WindowManager: Losing focus: Window{442f7318 u0 Application Error: org.test.myapp EXITING}

02-02 22:47:54.533   864  4129 I ActivityManager: Process org.test.myapp (pid 24142) has died.

02-02 22:47:54.536   239   506 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:-1,c:239) disconnect: api=2

02-02 22:47:54.536   239   506 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:-1,c:239) getReleasedBuffers: returning mask 0xffffffff

02-02 22:47:54.541   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:-1,c:-1) consumerDisconnect

02-02 22:47:54.542   239   239 I BufferQueue: [Starting org.test.myapp](this:0xb8806c18,id:643,api:2,p:-1,c:-1) ~BufferQueue

02-02 22:47:54.612   239   506 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:-1,c:239) disconnect: api=2

02-02 22:47:54.612   239   506 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:-1,c:239) getReleasedBuffers: returning mask 0xffffffff

02-02 22:47:54.626   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:-1,c:-1) consumerDisconnect

02-02 22:47:54.626   239   239 I BufferQueue: [Application Error: org.test.myapp](this:0xb8784428,id:644,api:2,p:-1,c:-1) ~BufferQueue

---- 2 Feb 2017 22:48:54 ----
FeralBytes commented 7 years ago

@Terraydaktal I may have a solution for you. Do me a favor; make sure that your building with a log level of 2; and copy and paste the build log here.

Terrydaktal commented 7 years ago

buildlog.txt

Terrydaktal commented 7 years ago

hmm why does it say sdk20, it was 25 once

FeralBytes commented 7 years ago

You should install these: [WARNING]: Missing executable: autoconf is not installed [WARNING]: Missing executable: automake is not installed [WARNING]: Missing executable: libtoolize is not installed

FeralBytes commented 7 years ago

Are these all of your files? Copy /home/lewis/project/save

Copy /home/lewis/project/decorator.py

Copy /home/lewis/project/raw

Copy /home/lewis/project/calculator.kv

Copy /home/lewis/project/main.py

FeralBytes commented 7 years ago

OK your error was not the same as mine; but let me know if either of those help.

Terrydaktal commented 7 years ago

OK I'll make that sdk 25.2.5 and I'll install those and get back to you, yes my files are save.txt, raw.txt decorator.py, main.py, calculator.kv

Terrydaktal commented 7 years ago

Apparently it was up to date, it displays android-sdk-20 but inside it are the latest 25.2.5 build tools. I have installed those 3 things and the warnings no longer appear when building. The app crashes still however. And my android 6 device shows

backtrace:
    #00 pc 000b0418  /data/data/org.test.myapp/files/app/lib/python2.7/site-packages/numpy/core/multiarray.so
    #01 pc 000b26e5  /data/data/org.test.myapp/files/app/lib/python2.7/site-packages/numpy/core/multiarray.so

again, :( , and yes i have the latest numpy recipe

raydatascience commented 6 years ago

Hello All,

I have developed a very simple app with Kivy & KivyMD and everything works fine. Even the build for android (command: buildozer android debug) works perfectly fine but the app crashes right after running. I seem not to be able to find out what the problem is. I have attached both buildozer.spec (I had to change it to buildozer.txt to upload) and logcat.txt for your review. Please help. buildozer.txt logcat.txt

dessant commented 6 years ago

@raythenewuser, you may have better luck with your request on the support channels: https://github.com/kivy/python-for-android#support.

raydatascience commented 6 years ago

Thanks. Just posted it there too.

tito commented 6 years ago

I just got the issue too on Android 4.4.2 (using emulator and real device) VS 8.0 (works ok), when packaging again an app. Dunno what have changed before, but the error is in the log posted here as well as mine:

01-22 00:26:28.866 24742 24742 E dalvikvm: dlopen("/data/app-lib/org.test.myapp-2/libpython2.7.so") failed: dlopen failed: could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by cannot locate symbol "signal" referenced by "libssl1.0.2h.so"...

And the p4a configuration:

[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (19, 21, 22, 23)
[INFO]:    Requested API target 23 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[INFO]:    Using Google NDK r13b
[INFO]:    Found virtualenv at /home/tito/.conda/envs/pebblo/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
inclement commented 5 years ago

Closing as this was fixed some time ago.