Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p4a apk crash "IndexError: list index out of range" #1570

Closed
homdx opened this issue Jan 9, 2019 · 9 comments
Closed

p4a apk crash "IndexError: list index out of range" #1570

homdx opened this issue Jan 9, 2019 · 9 comments

Comments

@homdx
Copy link

homdx commented Jan 9, 2019

I probe compile hello world with env by @Jonast in docker:
https://github.com/JonasT/p4a-build-spaces/

./p4aspaces shell p4a-py3-api28ndk21
#p4a apk

log:

[INFO]:    -> running mv /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/site-packages/kivy/_clock.cpython-37m-x86_64-linux-gnu.so /root/.local/share/python-for-android/...(and 79 more)
[INFO]:    -> running mv /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/site-packages/kivy/weakproxy.cpython-37m-x86_64-linux-gnu.so /root/.local/share/python-for-andro...(and 85 more)
[INFO]:    -> running mv /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/site-packages/kivy/properties.cpython-37m-x86_64-linux-gnu.so /root/.local/share/python-for-andr...(and 87 more)
[INFO]:    <- directory context /root/test
[INFO]:    Stripping libraries
[INFO]:    -> running find /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/modules /root/.local/share/python-for-android/dists/unnamed_dist_1/libs -iname *.so
[INFO]:    Stripping libraries in private dir                                                                                                                                                                                                
[INFO]:    Frying eggs in /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/site-packages
[INFO]:    -> directory context /root/.local/share/python-for-android/dists/unnamed_dist_1
[INFO]:    Saving distribution info
[INFO]:    <- directory context /root/test
[INFO]:    # Your distribution was created successfully, exiting.
[INFO]:    Dist can be found at (for now) /root/.local/share/python-for-android/dists/unnamed_dist_1
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:         unnamed_dist_1: min API 21, includes recipes (hostpython3, sdl2_image, sdl2_mixer, sdl2_ttf, python3, sdl2, six, pyjnius, kivy, requests3), built for archs (armeabi-v7a)
[INFO]:    unnamed_dist_1 has compatible recipes, using this one
Traceback (most recent call last):
  File "/usr/local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==0.6.0', 'console_scripts', 'p4a')()
  File "/usr/local/lib/python3.6/dist-packages/pythonforandroid/toolchain.py", line 1033, in main
    ToolchainCL()
  File "/usr/local/lib/python3.6/dist-packages/pythonforandroid/toolchain.py", line 553, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python3.6/dist-packages/pythonforandroid/toolchain.py", line 151, in wrapper_func
    func(self, args)
  File "/usr/local/lib/python3.6/dist-packages/pythonforandroid/toolchain.py", line 776, in apk
    unknown_args[i+1] = realpath(expanduser(unknown_args[i+1]))
IndexError: list index out of range

real    21m16.842s
user    13m15.721s
sys     3m53.464s
root@da199853fc95:~/test# cat .p4a 
--arch=armeabi-v7a
--name 'test'
--package com.example.test
--version 1
--permission=INTERNET
--requirements=python3,kivy,requests3
--private


root@da199853fc95:~/test#

Build without error:

#p4a apk --private .

.p4a file:

#cat .p4a
--arch=armeabi-v7a
--name 'test'
--package com.example.test
--version 1
--permission=INTERNET
--requirements=python3,kivy,requests3
root@da199853fc95:~/test#
@homdx
Copy link
Author

homdx commented Jan 14, 2019

Also build withour error:

#cat .p4a
--arch=armeabi-v7a
--name 'test'
--package com.example.test
--version 1
--permission=INTERNET
--requirements=python3,kivy,requests3
--private .
root@da199853fc95:~/test#

It looks like the incorrect definition of the parameters p4a --private.
They should be 2? Or it can be one?

@ghost
Copy link

ghost commented Jan 15, 2019

@homdx I made an attempt to fix the odd backtrace here: #1591

@homdx
Copy link
Author

homdx commented Jan 15, 2019

Cannt check you pull request:

./p4aspaces shell p4a-py3-api28ndk19 --p4a https://github.com/JonasT/python-for-android/archive/fixargparseerror.zip
log

[INFO]:    # Building recipes
[INFO]:    Building hostpython3 for armeabi-v7a
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build
[INFO]:    -> running configure
[INFO]:    <- directory context /root/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3                                                                                                                     
[INFO]:    -> running cp Modules/Setup.dist /root/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Modules/Setup
[INFO]:    -> running make -C /root/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build
[INFO]:    <- directory context /root/1                                                                                                                                                                                                      
[INFO]:    Building sdl2_image for armeabi-v7a
[INFO]:    Building sdl2_mixer for armeabi-v7a
[INFO]:    Building sdl2_ttf for armeabi-v7a
[INFO]:    Building python3 for armeabi-v7a
[ERROR]:   Build failed: Target ndk-api is 19, but the python3 recipe supports only 21+
#cat .p4a
--arch=armeabi-v7a
--name 'test'
--package com.example.test
--version 1
--permission=INTERNET
--requirements=python3,kivy,requests3
--private

@ghost
Copy link

ghost commented Jan 15, 2019

Well you need to use a minimum API level 21+, as the error says (try p4a-py3-api28ndk21)

@homdx
Copy link
Author

homdx commented Jan 15, 2019

./p4aspaces shell p4a-py2-api28ndk21

[INFO]:    Dist can be found at (for now) /root/.local/share/python-for-android/dists/unnamed_dist_1
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:    	unnamed_dist_1: min API 21, includes recipes (hostpython3, sdl2_image, sdl2_mixer, sdl2_ttf, python3, sdl2, six, pyjnius, kivy, requests3), built for archs (armeabi-v7a)
[INFO]:    unnamed_dist_1 has compatible recipes, using this one
Traceback (most recent call last):
  File "/usr/local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==0.6.0', 'console_scripts', 'p4a')()
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 1033, in main
    ToolchainCL()
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 553, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 151, in wrapper_func
    func(self, args)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 776, in apk
    unknown_args[i+1] = realpath(expanduser(unknown_args[i+1]))
IndexError: list index out of range
real 1061.15
user 795.12
sys 198.19

root@dbbb8ee6e9a2:~/testapp-sdl2-keyboard# cat .p4a 
--arch=armeabi-v7a
--name 'test'
--package com.example.test
--version 1
--permission=INTERNET
--requirements=python3,kivy,requests3
--private

@ghost
Copy link

ghost commented Jan 15, 2019

Did you specify the --p4a option for the pull request?

@homdx
Copy link
Author

homdx commented Jan 15, 2019

Sorry. Dont give argument for --p4a :(
Next Attempt

./p4aspaces shell p4a-py2-api28ndk21 --p4a https://github.com/JonasT/python-for-android/archive/fixargparseerror.zip

[INFO]:    Frying eggs in /root/.local/share/python-for-android/dists/unnamed_dist_1/_python_bundle/_python_bundle/site-packages
[INFO]:    -> directory context /root/.local/share/python-for-android/dists/unnamed_dist_1
[INFO]:    Saving distribution info
[INFO]:    <- directory context /root
[INFO]:    # Your distribution was created successfully, exiting.
[INFO]:    Dist can be found at (for now) /root/.local/share/python-for-android/dists/unnamed_dist_1
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:    	unnamed_dist_1: min API 21, includes recipes (hostpython3, sdl2_image, sdl2_mixer, sdl2_ttf, python3, sdl2, six, pyjnius, kivy, requests3), built for archs (armeabi-v7a)
[INFO]:    unnamed_dist_1 has compatible recipes, using this one
[INFO]:    -> directory context /root/.local/share/python-for-android/dists/unnamed_dist_1
usage: p4a [-h] [--private PRIVATE] --package PACKAGE --name NAME
           [--numeric-version NUMERIC_VERSION] --version VERSION [--launcher]
           [--permission PERMISSIONS [PERMISSIONS ...]]
           [--meta-data META_DATA] [--icon ICON] [--presplash PRESPLASH]
           [--presplash-color PRESPLASH_COLOR] [--window]
           [--orientation ORIENTATION] [--wakelock] [--blacklist BLACKLIST]
           [--whitelist WHITELIST] [--add-jar ADD_JAR] [--add-aar ADD_AAR]
           [--depend DEPENDS] [--sdk SDK_VERSION] [--minsdk MIN_SDK_VERSION]
           [--allow-minsdk-ndkapi-mismatch] [--intent-filters INTENT_FILTERS]
           [--with-billing BILLING_PUBKEY] [--add-source EXTRA_SOURCE_DIRS]
           [--try-system-python-compile] [--no-compile-pyo] [--sign]
           [--add-activity ADD_ACTIVITY]
           [--activity-launch-mode ACTIVITY_LAUNCH_MODE]
           [--allow-backup ALLOW_BACKUP] [--no-optimize-python]
p4a: error: argument --private: expected one argument

real	19m2.924s
user	14m32.496s
sys	3m32.120s

@ghost
Copy link

ghost commented Jan 15, 2019

@homdx ok that is the expected output! very nice. --private needs an argument since it specifies your private data, see also [--private PRIVATE]. I just fixed that it gave that weird error backtrace instead of a proper error.

You should specify your project directory with --private where your main.py is, so just do that and it should build fine 👍

@inclement
Copy link
Member

Closed by #1591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants