Permission Denied on building apk with builozer

311 views
Skip to first unread message

xiez...@gmail.com

unread,
Aug 29, 2017, 10:01:38 PM8/29/17
to kivy-...@googlegroups.com
Hi everyone.
I want to deploy my kivy project to an android device,
but buildozer failed when copying the apk file to './'(namely `/usr/local/lib/python3.5/dist-packages/pythonforandroid`).

should I run buildozer in root or write a bug report?

Update: Well I successfully make buildozer get its work done by adding `os.chdir()` to line 793
in `/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py`.

I don't know whether it will reproduce, but I'll try to write an issue to github. Thank you any way.

output of pip freeze
```
alabaster==0.7.10
appdirs==1.4.3
apturl==0.5.2
asn1crypto==0.22.0
attrs==16.3.0
autograd==1.1.13
Automat==0.5.0
Babel==2.5.0
bcloud==3.9.0
beautifulsoup4==4.5.3
bleach==1.5.0
blinker==1.3
Brlapi==0.6.4
buildozer==0.33
cffi==1.10.0
chardet==2.3.0
checkbox-support==0.22
colorama==0.3.9
command-not-found==0.3
constantly==15.1.0
cryptography==1.8.1
cssselect==1.0.1
cycler==0.10.0
Cython==0.21
decorator==4.0.11
defer==1.0.6
dictset==0.3.1.2
docutils==0.14
entrypoints==0.2.2
enum34==1.1.6
et-xmlfile==1.0.1
feedparser==5.1.3
future==0.16.0
guacamole==0.9.2
h5py==2.7.0
html5lib==0.9999999
httplib2==0.9.1
idna==2.5
imagesize==0.7.1
incremental==16.10.1
indicator-cpufreq==0.2.2
ipykernel==4.5.2
ipython==5.3.0
ipython-genutils==0.2.0
ipywidgets==6.0.0
jdcal==1.3
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.0.0
jupyter-console==5.1.0
jupyter-core==4.3.0
Kivy==1.10.1.dev0
Kivy-Garden==0.1.4
language-selector==0.1
louis==2.6.4
lxml==3.7.3
Mako==1.0.3
Markdown==2.6.9
MarkupSafe==1.0
matplotlib==2.0.0
mistune==0.7.4
nbconvert==5.1.1
nbformat==4.3.0
networkx==1.11
nltk==3.2.2
notebook==4.4.1
numpy==1.13.1
oauthlib==1.0.3
openpyxl==2.4.5
packaging==16.8
padme==1.1.1
pandas==0.19.2
pandoc-attributes==0.1.7
pandoc-tablenos==0.16
pandoc-xnos==0.9
pandocfilters==1.4.1
parsel==1.1.0
pexpect==4.2.1
pickleshare==0.7.4
Pillow==3.1.2
plainbox==0.25
prompt-toolkit==1.0.13
protobuf==3.4.0
psutil==5.2.2
ptyprocess==0.5.2
pyasn1==0.2.3
pyasn1-modules==0.0.8
pycparser==2.17
pycrypto==2.6.1
pycups==1.9.73
pycurl==7.43.0
PyDispatcher==2.0.5
pygame==1.9.3
Pygments==2.2.0
pygobject==3.20.0
pyinotify==0.9.6
PyJWT==1.3.0
pyOpenSSL==16.2.0
pyparsing==2.2.0
PyPDF2==1.26.0
pyperclip==1.5.27
pystaggrelite3==0.1.3
python-apt==1.1.0b1
python-dateutil==2.6.0
python-debian==0.1.27
python-for-android==0.5.3
python-pptx==0.6.5
python-systemd==231
pytz==2017.2
pyvttbl==0.5.2.2
PyWavelets==0.5.2
pyxdg==0.25
pyzmq==16.0.2
qtconsole==4.2.1
queuelib==1.4.2
reportlab==3.3.0
requests==2.9.1
rm-protection==0.1.3
roman==2.0.0
savReaderWriter==3.4.2
scikit-image==0.13.0
scikit-learn==0.18.1
scipy==0.19.0
Scrapy==1.3.3
scrapy-splash==0.7.2
scrapyjs==0.2
screen-resolution-extra==0.0.0
seaborn==0.7.1
selenium==3.4.2
service-identity==16.0.0
sessioninstaller==0.0.0
sh==1.12.4
simplegeneric==0.8.1
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.3
sphinxcontrib-websupport==1.0.1
system-service==0.3
tensorflow-gpu==1.3.0
tensorflow-tensorboard==0.1.5
tensorlayer==1.4.2
terminado==0.6
testpath==0.3
tflearn==0.3.2
thulac==0.1.1
tornado==4.4.2
traitlets==4.3.2
Twisted==17.1.0.dev0
ubuntu-drivers-common==0.0.0
ufw==0.35
unattended-upgrades==0.1
unity-scope-calculator==0.1
unity-scope-chromiumbookmarks==0.1
unity-scope-colourlovers==0.1
unity-scope-devhelp==0.1
unity-scope-firefoxbookmarks==0.1
unity-scope-gdrive==0.7
unity-scope-manpages==0.1
unity-scope-openclipart==0.1
unity-scope-texdoc==0.1
unity-scope-tomboy==0.1
unity-scope-virtualbox==0.1
unity-scope-yelp==0.1
unity-scope-zotero==0.1
urllib3==1.13.1
usb-creator==0.3.0
virtualenv==15.1.0
w3lib==1.17.0
wcwidth==0.1.7
webencodings==0.5
Werkzeug==0.12.2
widgetsnbextension==2.0.0
xdiagnose==3.8.4.1
xkit==0.0.0
xlrd==1.0.0
XlsxWriter==0.7.3
xlwt==1.2.0
zope.interface==4.4.0
```
output of buildozer
```
ericx@ericx-Lenovo-U31-70:~/Eric/MyPrograms/kivyproj/enquete$ buildozer android debug > log.log
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19, 26)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r9c, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:        enquete: includes recipes (hostpython2, sdl2_image, sdl2_mixer, sdl2_ttf, python2, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    enquete has compatible recipes, using this one
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (19, 26)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r9c, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:        enquete: includes recipes (hostpython2, sdl2_image, sdl2_mixer, sdl2_ttf, python2, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    enquete has compatible recipes, using this one
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:        enquete: includes recipes (hostpython2, sdl2_image, sdl2_mixer, sdl2_ttf, python2, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    enquete has compatible recipes, using this one
[INFO]:    -> directory context /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete
[DEBUG]:   -> running ant debug
[DEBUG]:       Buildfile: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/build.xml
[DEBUG]:      
[DEBUG]:       -set-mode-check:
[DEBUG]:      
[DEBUG]:       -set-debug-files:
[DEBUG]:      
[DEBUG]:       -check-env:
[DEBUG]:        [checkenv] Android SDK Tools Revision 25.2.5
[DEBUG]:        [checkenv] Installed at /home/ericx/Android/OriginalSdk
[DEBUG]:      
[DEBUG]:       -setup:
[DEBUG]:            [echo] Project Name: Enquete-0.1
[DEBUG]:         [gettype] Project Type: Application
[DEBUG]:      
[DEBUG]:       -set-debug-mode:
[DEBUG]:      
[DEBUG]:       -debug-obfuscation-check:
[DEBUG]:      
[DEBUG]:       -pre-build:
[DEBUG]:            [copy] Copying 24 files to /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/tmp-src
[DEBUG]:      
[DEBUG]:       -build-setup:
[DEBUG]:       [getbuildtools] Using latest Build Tools: 26.0.1
[DEBUG]:            [echo] Resolving Build Target for Enquete-0.1...
[DEBUG]:       [gettarget] Project Target:   Android 4.4.2
[DEBUG]:       [gettarget] API level:        19
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Creating output directories if needed...
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Resolving Dependencies for Enquete-0.1...
[DEBUG]:       [dependency] Library dependencies:
[DEBUG]:       [dependency] No Libraries
[DEBUG]:       [dependency]
[DEBUG]:       [dependency] ------------------
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Building Libraries with 'debug'...
[DEBUG]:          [subant] No sub-builds to iterate on
[DEBUG]:      
[DEBUG]:       -code-gen:
[DEBUG]:       [mergemanifest] Found modified input file
[DEBUG]:       [mergemanifest] Merging AndroidManifest files into one.
[DEBUG]:       [mergemanifest] Manifest merger disabled. Using project manifest only.
[DEBUG]:            [echo] Handling aidl files...
[DEBUG]:            [aidl] No AIDL files to compile.
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Handling RenderScript files...
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Handling Resources...
[DEBUG]:            [aapt] Found modified input file
[DEBUG]:            [aapt] Generating resource IDs...
[DEBUG]:            [echo] ----------
[DEBUG]:            [echo] Handling BuildConfig class...
[DEBUG]:       [buildconfig] No need to generate new BuildConfig.
[DEBUG]:      
[DEBUG]:       -pre-compile:
[DEBUG]:      
[DEBUG]:       -compile:
[DEBUG]:           [javac] Compiling 25 source files to /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/classes
[DEBUG]:           [javac] 警告: [options] 源值1.5已过时, 将在未来所有发行版中删除
[DEBUG]:           [javac] 警告: [options] 目标值1.5已过时, 将在未来所有发行版中删除
[DEBUG]:           [javac] 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
[DEBUG]:           [javac] 注: 某些输入文件使用或覆盖了已过时的 API。
[DEBUG]:           [javac] 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
[DEBUG]:           [javac] 3 个警告
[DEBUG]:      
[DEBUG]:       -post-compile:
[DEBUG]:      
[DEBUG]:       -obfuscate:
[DEBUG]:      
[DEBUG]:       -dex:
[DEBUG]:             [dex] input: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/classes
[DEBUG]:             [dex] Found modified input file
[DEBUG]:             [dex] Converting compiled files and external libraries into /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/classes.dex...
[DEBUG]:      
[DEBUG]:       -crunch:
[DEBUG]:          [crunch] Crunching PNG Files in source dir: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/res
[DEBUG]:          [crunch] To destination dir: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/res
[DEBUG]:          [crunch] Processing image to cache: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/res/drawable/icon.png => /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/res/drawable/icon.png
[DEBUG]:          [crunch]   (processed image to cache entry /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/res/drawable/icon.png: 49% size of source)
[DEBUG]:          [crunch] Crunched 1 PNG files to update cache
[DEBUG]:      
[DEBUG]:       -package-resources:
[DEBUG]:            [aapt] Found modified input file
[DEBUG]:            [aapt] Creating full resource package...
[DEBUG]:      
[DEBUG]:       -package:
[DEBUG]:       [apkbuilder] Found modified input file
[DEBUG]:       [apkbuilder] Creating Enquete-0.1-debug-unaligned.apk and signing it with a debug key...
[DEBUG]:      
[DEBUG]:       -post-package:
[DEBUG]:      
[DEBUG]:       -do-debug:
[DEBUG]:        [zipalign] Running zip align on final apk...
[DEBUG]:            [echo] Debug Package: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/Enquete-0.1-debug.apk
[DEBUG]:       [propertyfile] Updating property file: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/build.prop
[DEBUG]:       [propertyfile] Updating property file: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/build.prop
[DEBUG]:       [propertyfile] Updating property file: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/build.prop
[DEBUG]:       [propertyfile] Updating property file: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/build.prop
[DEBUG]:      
[DEBUG]:       -post-build:
[DEBUG]:          [delete] Deleting directory /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/tmp-src
[DEBUG]:      
[DEBUG]:       debug:
[DEBUG]:      
[DEBUG]:       BUILD SUCCESSFUL
[DEBUG]:       Total time: 4 seconds
[INFO]:    <- directory context /usr/local/lib/python3.5/dist-packages/pythonforandroid
[INFO]:    # Copying APK to current directory
[INFO]:    # Found APK file: /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/Enquete-0.1-debug.apk
[DEBUG]:   -> running cp /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/Enquete-0.1-debug.apk ./
[DEBUG]:       /bin/cp: Cannot create a regular file './Enquete-0.1-debug.apk': Permission Denied
Exception in thread background thread for pid 2113:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1:

  RAN: /bin/cp /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/Enquete-0.1-debug.apk ./

  STDOUT:
/bin/cp: Cannot create a regular file'./Enquete-0.1-debug.apk': Permission Denied


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py", line 916, in <module>
    main()
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py", line 913, in main
    ToolchainCL()
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py", line 514, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py", line 148, in wrapper_func
    func(self, args)
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/toolchain.py", line 793, in apk
    shprint(sh.cp, apk_file, './')
  File "/usr/local/lib/python3.5/dist-packages/pythonforandroid/logger.py", line 175, in shprint
    for line in output:
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 720, in next
    self.wait()
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.5/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1:

  RAN: /bin/cp /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build/dists/enquete/bin/Enquete-0.1-debug.apk ./

  STDOUT:
/bin/cp: Cannot create a regular file './Enquete-0.1-debug.apk': Permission Denied


  STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name enquete --name Enquete --version 0.1 --package org.enquete.enquete --android_api 19 --sdk 19 --minsdk 9 --private /home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/app --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir=/home/ericx/Eric/MyPrograms/kivyproj/enquete/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
```
log.log
Reply all
Reply to author
Forward
0 new messages