Kivy and buildozer "Permission denied" - android

few days ago I got into Android app creating. I learned about Kivy. It simplicity overwhelmed so I decided to stick to it and try to design some App. The Dev team provides Buildozer to build the App for Android easily - but I have not been able to do this step.
In the process of creating the App for Android I get two errors, since I don't know whether they relate I'll present both of them.
First error
When I run my application on Linux (Ubuntu) I got an Error, although the App works and it looks like there is no problem. The error log:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 761, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mtdev.py", line 193, in _thread_run
_device = Device(_fn)
File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
OSError: [Errno 13] Permission denied: '/dev/input/event7'
Second Error
I'have installed buildozer using sudo pip install buildozer. When I try to use buildozer init I got following error:
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2257, in activate
self.insert_on(path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2364, in insert_on
self.check_version_conflict()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2403, in check_version_conflict
for modname in self._get_metadata('top_level.txt'):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2251, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.2-py2.7.egg/EGG-INFO/top_level.txt'
This error prevents the process from going on and buildozer init fails to create buildozer.spec.
More information
In fact I have tried to run both the app, lets say sudo main.py and sudo buildozer init. At first it seemed to solve the issue, but the first time I ran buildozer android debug deploy run it took forever and unfortunately I had to kill it.
The second time I wanted to do it properly, and it was strange to me that in the example they do not use sudo. Also I have found everywhere NEVER run buildozer with sudo. So, I unistalled both kivy and buildozer, and installed it again, restart my pc. But nothing changed. Maybe my stupid app has some issues (that might solve the first error), but probably not the second one. Any help appreciated - also I can give more information.
Note
I've looked on other questions, but they seemed to solve different issues.

First Error: not an issue. Your user doesn't have access to directly read the input device - but usually that's because it's a laptop touchpad which Kivy doesn't need to read anyway (it uses it as a mouse, not a touch input device). You can safely ignore that one - if it really bothers you, you can modify udev rules to give your user access to those devices.
Second Error: apparently due to an issue with the Google API package. Uninstalling that package fixes buildozer. You might be able to reinstall it now (maybe the Google package didn't install properly, which confused pkg_resources when it was scanning things?). If not, you could try installing that package in a virtualenv to separate it from other packages.

Related

How to solve this valgrind issue?

I'm trying to run valgrind on an android OS but it couldn't start and it shows this errors that i couldn't find how to solve:
valgrind: Startup or configuration error:
Can't create client cmdline file in /tmp/valgrind_proc_87_cmdline_876a7612
valgrind: Unable to start up properly. Giving up.
Thanks in advance !
I tried to change the default path that valgrind use and which is shown on the error log but i couldn't make it
The problem is happening in the code where the Valgrind host is creating a fake /proc/<pid>/cmdline.
This file should be created in the location given by the first valid item in the following list:
The TMPDIR environment variable
The constant VG_TMPDIR that gets baked into the binary via a configure time option. This defaults to /tmp but can be overriden using configure --with-tmpdir=/your/tmp/dir. That would require that you get the Valgrind source and configure and build it. It is possible that you are using a package that was built using this option and is not compatible with your system.
Last resort, "/tmp"
All of the above checks just test that the string is non-null and not empty. They do not test for the existance and accessibility of the directory. That gets determined by the Valgrind version of mkstemp and the error message comes from 'valgrind_main'.
Valgrind needs to create a file TMPDIR/valgrind_proc_PID_cmdline_RAND where TMPDIR is described above, PID is the pid of the Valgrind process and RAND is a random number.
There is at least one other similar files that get created, for auxv.
There are no Valgrind command line options to turn off the creation of these files.

Automation testing error while starting Test Cases

What is causing this error when I run my Android app's automated testing?
C:\Users\sujan\PycharmProjects\code\auto_env\OTT_Client
Traceback (most recent call last):
File "src/Utilities_test/Convert_csvToPy.py", line 13, in <module>
from template.cases_template import test_case_dict
ImportError: bad magic number in 'template': b'\x03\xf3\r\n'
command 'python src/Utilities_test/Convert_csvToPy.py Test_cases.csv' return with error (code 1): b''
This error probably is a result of a mix between 2.7 & 3+ versions, also happens if you have manually named your file with an extension .pyc
the error isn't actually coming from your test cases. The magic number comes from UNIX-type systems where the first few bytes of a file held a marker indicating the file type. Python puts a similar marker into its pyc files when it creates them.
Then the python interpreter makes sure this number is correct when loading it.
Anything that corrupts this magic number will cause your problem, like if you edit a pyc file or your trying to run from a different version of python
as for fixing it you could try a few things. You could try to do a clean on the pyc files something like
find . -name "*.pyc" -exec rm -f {} \;
The command above will delete all pyc files recursively. then just run again and it should recompile
or if you cloned something from a repo just delete and and reclone

Can't build jxcore for android

I wanted to build the JXcore libraries for android, and i have encountered an error.
I have met all the Prerequisites:
I'm running ubuntu 16.04, with gcc 5.4.0, python 2.7.12,GNU Make 4.1.
This are the steps i have followed:
I have downloaded android ndk, and extracted it in ~/Downloads/android-ndk-r12b
cloned the jxcore library in ~/Downloads/jxcore
cd into jxcore
ran build_scripts/android-configure.sh ../android-ndk-r12b/, this script finished successfully
Then i needed to run build_scripts/android_compile.sh ../android-ndk-r12b/ --embed-leveldown
And i hit an error in the last step, this is the log:
Compiling Android ARM7
Traceback (most recent call last):
File "./configure", line 1119, in <module>
configure_node(output)
File "./configure", line 645, in configure_node
configure_arm(o)
File "./configure", line 569, in configure_arm
elif is_arm_hard_float_abi():
File "./configure", line 491, in is_arm_hard_float_abi
if compiler_version() >= (4, 6, 0):
File "./configure", line 560, in compiler_version
version = tuple(map(int, proc.communicate()[0].split('.')))
ValueError: invalid literal for int() with base 10: 'x\n'
compilation aborted for arm target
Does anyone know what causes this, or a fix for it ?
I ran into the same problem. I did a quick and dirty fix just to get going.
Open the "configure" file in your jxcore folder. Go to line number 560 as in the last entry in your log. Comment out line 560 with the # in front.
Insert a changed version of that line underneath as shown below:
line 560: #version = tuple(map(int, proc.communicate()[0].split('.')))
line 561: version = tuple(map(int, "4.9.0".split('.')))
... basically what happens is that your version of CC goes something like "4.9.x" and as Python fails to convert the "x" to an integer the process stops. I just replaced the "x" with a "0". However you might want to check your version just to be safe. Therefore place print proc.communicate()[0] right before line 560 before you make the other changes. Then your actual version number will be printed out in your log, when you run the program again.
I hope that may help you.

ValueError: can't find recovery API version in input target-files

I am trying to create a patch for different AOSP versions upgrading, without changing the APKs located in app or priv-app folders, which means the APPs version should hold still in the original versions.
I’ve checked the OTA Package Tools out on AOSP website:
Right now, I have the AOSP source code in Ubuntu 12.04 and trying to implement the "incremental updates" with command shown as the website.
However, a ValueError message appears after I do that as the following:
unzipping target target-files...
Traceback (most recent call last):
File "./build/tools/releasetools/ota_from_target_files", line 1119, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/ota_from_target_files", line 1062, in main
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
File "~/openlinux_kk-amlogic/build/tools/releasetools/common.py", line 120, in LoadInfoDict
raise ValueError("can't find recovery API version in input target-files")
ValueError: can't find recovery API version in input target-files
Could anybody do me a favor to provide some methods possibly solve this problem?
The problem I have successfully gotten the answer, I have to make my patch file with the zip file target_files.zip, not the general zip file, then the python is able to create the patch file.
However, I still have a problem that after I finish creating the patch file, and trying to flash it via adb sideload command,
After finish flashing this procedure, the result after I flashing the zip didn’t work, and a message shown as the following:
system/bin/filename” has unexpected contents
That filename stands for the file I tuned it in the patch file, as the figure shown:
If my method is wrong, does anybody know how to apply the patch I created with sideload flashing?
Thank you in advanced.

SSL 480 error in python Requests

I have scripts relying on the python "Requests" library. Two different scripts relying on the same lib all throw the same error (Tweepy crashes because of it, as does a simple HTTP GET):
xtras/python/requests/api.py", line 44, in request return
session.request(method=method, url=url, **kwargs)
File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/sessions.py",
line 461, in request
resp = self.send(prep, **send_kwargs) File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/sessions.py",
line 567, in send r = adapter.send(request, **kwargs)
File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/adapters.py",
line 400, in send raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:480:
error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message
digest algorithm
This has only started happening recently (it worked fine before). The script is running on an Android phone using SL4A.
I had the exact same issue. As far as I can tell, this problem is caused by the version/build of Python installed on your phone. I assume you are using the Python 2 apk from the Py4a project.
To solve the problem, you can install the Python 3 apk which seems to better support SSL, but if you do so, you will need to port your scripts from Python 2 to Python 3.

Categories

Resources