Can't build jxcore for android - 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.

Related

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

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.

charmap can't decode byte 0x8d

I'm trying to create an APK from a C++ code with Cocos Framework (cocos2d-x 3.8.1)
When i go in the directory and use the command line "cocos run -p android", i got an error
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position
29180: character maps to undefined
This happen when the following line is called
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
in the file
"\Python\Python35-32\lib\encodings\cp1252.py", line 23
Any idea about how to fix this ?
Cocos2d requires Python 2.7 to run. You are getting that error because of your Python version (Which is the 3.5v).
That command is going to search for the python.exe from your Python directory.
I suggest you to download the 2.7 version and rename the python.exe to python3.exe in your "Python\Python35-32" directory, so that the Python2.7\python.exe is run. This works to me.

Kivy and buildozer "Permission denied"

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.

How to create Cocos2d-x v3.0 Beta 2 android ndk project

I got the build successful with cocos2d-x v2.2.2. Then I follow this tutorial to build cocos2d-x v3.0 beta 2 project
The command project-creator worked fine and I can create all supported platform projects.
Everything is ok except I have an error with build_native.py script:
line 25
print "Can't know cpuinfo, use default 1 cpu"
^
SyntaxError: invalid syntax
As I don't have any experiment with python, so I have no idea with this bug.
Here is my environment detail:
Latest python for windows 3.3.4
Windows 8, 64 bit
Latest android sdk r22.3, ndk r9c
Already set these environment variables: ANDROID_SDK_ROOT, NDK_ROOT, ANDROID_SDK_ROOT/platform_tools, ANDROID_SDK_ROOT/tools
For the variable NDK_MODULE_PATH, I can't find folder likeplatform\third_party\android\prebuilt in cocos2d-x v3.0, so I don't know what to do with it
Do I miss something?
Update: after searching on google, I found that on python 3, print should be use as method, like print(""), then I replace all tabs by spaces to avoid inconsistent use of tabs and spaces in indentation error. But I still got another exception:
The Selected NDK toolchain version was 4.8 !
make.exe: *** D:\SycnDir\game: No such file or directory. Stop.
Traceback (most recent call last):
File "D:\My Games\proj.android\build_native.py", line 166, in <module>
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File "D:\My Games\proj.android\build_native.py", line 153, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "D:\My Games\proj.android\build_native.py", line 89, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root +
" ] fails!")
Exception: Build dynamic library for project [ D:\My Games\proj.android ] fails!
Finally I can make it worked. The exception is raised on these lines:
if os.system(command) != 0
raise Exception(“Build dynamic library for project [ " + app_android_root + " ] fails!”)
And I figure out space characters on my folder path caused ndk build failed. I can't believe this stupid bug make me waste two days. Now I just move my project into a folder without space and it worked like a charm.
The cocos2d-x 3.0 beta only works with Python 2.7 at this point. I suggest going back to Python 2.7 instead of trying to debug the script for Python 3.0.

Categories

Resources