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

ValueError: Tried to access ndk_ver but it has not been set - this should not happen, something went wrong! #893

Closed
Petar-Luketina opened this issue Apr 29, 2019 · 15 comments

Comments

@Petar-Luketina
Copy link

  • Python: 2.7
  • OS: Ubuntu 16
  • Buildozer: tried dev (up-to-date) & stable

Description

I'm trying to deploy my app with buildozer android deploy and buildozer android debug but I keep getting the same error no matter what settings I use. I tried:

p4a.source_dir = ~/p4a
p4a.bootstrap = sdl2

p4a.branch = master

android.api = 27
android.minapi = 21
android.sdk = 23
android.ndk = 17c
android.arch = armeabi-v7a

I also tried commenting out the the android. ... but neither solved my problem. Does anyone know what the error message means? Thank you in advance!

Logs

[INFO]:    Requested API target 27 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/pl/.buildozer/android/platform/android-ndk-r17c
[WARNING]: Android NDK version could not be found. This probablywon't cause any problems, but if necessary you canset it with `--ndk-version=...`.
[INFO]:    Getting NDK API version (i.e. minimum supported API) from user argument
Traceback (most recent call last):
  File "/home/pl/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/pl/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/pl/p4a/pythonforandroid/toolchain.py", line 1035, in <module>
    main()
  File "/home/pl/p4a/pythonforandroid/toolchain.py", line 1031, in main
    ToolchainCL()
  File "/home/pl/p4a/pythonforandroid/toolchain.py", line 551, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/pl/p4a/pythonforandroid/toolchain.py", line 142, in wrapper_func
    user_ndk_api=self.ndk_api)
  File "pythonforandroid/build.py", line 376, in prepare_build_environment
    info('Using {} NDK {}'.format(self.ndk.capitalize(), self.ndk_ver))
  File "pythonforandroid/build.py", line 147, in ndk_ver
    raise ValueError('Tried to access ndk_ver but it has not '
ValueError: Tried to access ndk_ver but it has not been set - this should not happen, something went wrong!
@nitanmarcel
Copy link

Hi! I see you have there a p4a.source_dir set. If you use a custom dir for python for android make sure you have the latest master branch :)

@Petar-Luketina
Copy link
Author

@nitanmarcel Thank you for reminding me! I just updated it, but I still get the same error.

@nitanmarcel
Copy link

nitanmarcel commented Apr 30, 2019

@Petar-Luketina make sure is the same error. The newer update brought me a new error as mentioned here kivy/python-for-android#1808

@nitanmarcel
Copy link

nitanmarcel commented Apr 30, 2019

Some things you could try:

  • Use the latest python version
    or/and
  • Make sure you're on the right branch on your cloned repository by doing a git checkout master
    and this is required:
  • Delete the .buildozer folder to make sure it builds again p4a

@Petar-Luketina
Copy link
Author

  • git checkout master

I tried the last two suggestions but I haven't tried to build with Python 3x. You still have to use Crysyax, correct?

@nitanmarcel
Copy link

  • git checkout master

I tried the last two suggestions but I haven't tried to build with Python 3x. You still have to use Crysyax, correct?

I don't really remember. When I installed buildozer I just installed the dependencies and install it with sudo python3 setup.py install

sudo apt install -y \
    build-essential \
    ccache \
    git \
    libncurses5:i386 \
    libstdc++6:i386 \
    libgtk2.0-0:i386 \
    libpangox-1.0-0:i386 \
    libpangoxft-1.0-0:i386 \
    libidn11:i386 \
    python2.7 \
    python2.7-dev \
    openjdk-8-jdk \
    unzip \
    zlib1g-dev \
    zlib1g:i386 \
    libltdl-dev \
    libffi-dev \
    libssl-dev \
    autoconf \
    autotools-dev
    cmake

# Install Buildozer
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python3 setup.py install

@Petar-Luketina
Copy link
Author

I did the above and got this error AttributeError: 'Namespace' object has no attribute 'ignore_setup_py'

@nitanmarcel
Copy link

nitanmarcel commented Apr 30, 2019

I did the above and got this error AttributeError: 'Namespace' object has no attribute 'ignore_setup_py'

Yes, that means you're on the right version 😆

The fix for that can be found here:

kivy/python-for-android#1809

@Petar-Luketina
Copy link
Author

Cool! That's good to know. What file do I add this code to:

    build_recipes(build_order, python_modules, ctx, args.private if hasattr(args, "private") else None,
                  ignore_project_setup_py=args.ignore_setup_py if hasattr(args, "ignore_setup_py") else False,
                 )

@nitanmarcel
Copy link

The toolchain.py file needs to be edited. That was just a lazy fix of mine and incomplete. Better wait for the devs to approve that PR by JonasT as it contains the full fix :)

@Petar-Luketina
Copy link
Author

Petar-Luketina commented Apr 30, 2019 via email

@nitanmarcel
Copy link

@Petar-Luketina the dev has approved the PR. Is safe to build your app now

@Petar-Luketina
Copy link
Author

@nitanmarcel I did this just now:

git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python3 setup.py install

I still got the same error. Did your deployment work?

@nitanmarcel
Copy link

nitanmarcel commented Apr 30, 2019

@Petar-Luketina The problem was with python-for-android so make sure you updated your repo, or comment out p4a.source_dir = ~/p4a and let buildozer download p4a for you.

Also make sure you deleted the . buildozer folder before building again :)

@Petar-Luketina
Copy link
Author

@nitanmarcel I appreciate all your help! It worked flawlessly.

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