Error when running setup.py for cocos2d - android

I'm following this guide for cocos2d and having a hard time figuring out why I get an error. I'm on the "Use setup.py to configure your android development environment" section in the guide. Every time I run setup.py I get this:
Setting up cocos2d-x...
->Check environment variable COCOS_CONSOLE_ROOT
->Search for environment variable COCOS_CONSOLE_ROOT...
->COCOS_CONSOLE_ROOT not found
-> Add COCOS_CONSOLE_ROOT environment variable...
Traceback (most recent call last):
File "setup.py", line 730, in <module>
opts.ndk_root, opts.android_sdk_root, opts.ant_root)
File "setup.py", line 687, in set_environment_variables
self.set_console_root()
File "setup.py", line 473, in set_console_root
COCOS_CONSOLE_ROOT, cocos_consle_root)
File "setup.py", line 206, in _set_environment_variable
ret = self._set_environment_variable_unix(key, value)
File "setup.py", line 186, in _set_environment_variable_unix
shutil.copy(self.file_used_for_setup, self.backup_file)
File "/usr/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: ''
I would appreciate any help!

Hi please check if you set all environment variables from mentioned guide. Message COCOS_CONSOLE_ROOT not found means that the environment variable is not visible or not set for current terminal session. Set environment vars and restart terminal and try run command again.

Related

infer -- gradle build is not working

I'm trying to use the Infer tool to analyze my app code. I followed these steps and every time I'm trying to run infer -- gradle build I'm getting the below errors :
infer -- gradle build
Running and capturing gradle compilation...
Traceback (most recent call last):
File "/usr/local/bin/infer", line 183, in <module>
main()
File "/usr/local/bin/infer", line 147, in main
capture_exitcode = imported_module.gen_instance(args,cmd).capture()
File "/usr/local/Cellar/infer/0.8.1/libexec/infer/lib/python/inferlib/capture/gradle.py", line 87, in capture
cmds = self.get_infer_commands(util.get_build_output(self.build_cmd))
File "/usr/local/Cellar/infer/0.8.1/libexec/infer/lib/python/inferlib/capture/util.py", line 25, in get_build_output
proc = subprocess.Popen(build_cmd, stdout=subprocess.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Any idea would be appreciated !!
I found that Infer is already included in the new android studio 2.2 where you can run it directly from Analyze->Infer Nullity then specify the scope.

Error when trying to use Android systrace.py on Linux Ubuntu

I am trying to run Systrace but I get an error when I run the command.
user1#PC1:~/Android/Sdk/platform-tools/systrace$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
user1#PC1:~/Android/Sdk/platform-tools/systrace$ ls
AUTHORS prefix.html systrace.py
LICENSE suffix.html systrace_trace_viewer.html
NOTICE systrace-legacy.py UPSTREAM_REVISION
user1#PC1:~/Android/Sdk/platform-tools/systrace$ python systrace.py --time=10 -o mynewtrace.html
Traceback (most recent call last):
File "systrace.py", line 320, in <module>
main()
File "systrace.py", line 158, in main
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I am currently running Ubuntu with Android SDK 5.1.1 installed along with Android Studio. Below is are my PATH export in .bashrc:
export PATH="~/Applications/android-studio/bin/:$PATH"
export PATH="~/Android/Sdk/platform-tools/:$PATH"
export PATH="~/Android/Sdk/tools/:$PATH"
Even though the answer is accepted, for those who face this problem in the future;
Run systrace from /platform-tools directory(adb is in /platform-tools directory) not from /platform-tools/systrace directory. E.g.
.../platform-tools$ python systrace/systrace.py
I fixed the issues by changing my PATH export to be specified by absolute path instead of relative path. This means, I can't define my home directory using ~/..., I have to use /home/username/....
export PATH="/home/user1/Applications/android-studio/bin/:$PATH"
export PATH="/home/user1/Android/Sdk/platform-tools/:$PATH"
export PATH="/home/user1/Android/Sdk/tools/:$PATH"
However, it is not clear to me why systrace.py won't properly run when PATH is defined using ~/... instead of /home/username/.... ADB works perfectly fine when the PATH is defined using ~/....

Move Android Sources to another Machine

So, Basically I've synced all the Cm-11.0 sources to my PC. Now I had move the sources to another PC. So i thought that copying just '.repo' folder and running repo sync -l to another PC will do the trick.
Now I have .repo folder and when I run repo sync it gives the following error
dkbhadeshiya#CrayJaguar:~/android/cm11$ repo sync -j1
Fetching project CyanogenMod/android_frameworks_webview
Traceback (most recent call last):
File "/home/dkbhadeshiya/android/cm11/.repo/repo/main.py", line 500, in <module>
_Main(sys.argv[1:])
File "/home/dkbhadeshiya/android/cm11/.repo/repo/main.py", line 476, in _Main
result = repo._Run(argv) or 0
File "/home/dkbhadeshiya/android/cm11/.repo/repo/main.py", line 155, in _Run
result = cmd.Execute(copts, cargs)
File "/home/dkbhadeshiya/android/cm11/.repo/repo/subcmds/sync.py", line 635, in Execute
fetched = self._Fetch(to_fetch, opt)
File "/home/dkbhadeshiya/android/cm11/.repo/repo/subcmds/sync.py", line 339, in _Fetch
self._FetchProjectList(**kwargs)
File "/home/dkbhadeshiya/android/cm11/.repo/repo/subcmds/sync.py", line 234, in _FetchProjectList
success = self._FetchHelper(opt, project, *args, **kwargs)
File "/home/dkbhadeshiya/android/cm11/.repo/repo/subcmds/sync.py", line 275, in _FetchHelper
no_tags=opt.no_tags, archive=self.manifest.IsArchive)
File "/home/dkbhadeshiya/android/cm11/.repo/repo/project.py", line 1076, in Sync_NetworkHalf
self._UpdateHooks()
File "/home/dkbhadeshiya/android/cm11/.repo/repo/project.py", line 2098, in _UpdateHooks
self._InitHooks()
File "/home/dkbhadeshiya/android/cm11/.repo/repo/project.py", line 2126, in _InitHooks
os.symlink(os.path.relpath(stock_hook, os.path.dirname(dst)), dst)
OSError: [Errno 20] Not a directory
and when I run Repo Sync -l It gives following error:
dkbhadeshiya#CrayJaguar:~/android/cm11$ repo sync -l
error: in `sync -l`: revision refs/heads/cm-11.0 in CyanogenMod/android_abi_cpp not found
Any Idea how to solve this??
Maybe you can try this command before you sync.
repo forall -vc "git reset --hard"

OSError: [Errno 2] No such file or directory when running systrace.py

I'm currently trying to run the systrace python script that is included in the platform-tools folder and I'm getting the following error:
File "systrace.py", line 274, in <module>
main()
File "systrace.py", line 60, in main
device_sdk_version = get_device_sdk_version()
File "systrace.py", line 44, in get_device_sdk_version
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I'M running on Ubuntu 12.04 LTS. Here is the command I'm using to run systrace:
sudo python systrace.py -o output.html
NOTE: The sudo is in order to avoid the following error:
File "systrace.py", line 274, in <module>
main()
File "systrace.py", line 63, in main
os.execv(legacy_script, sys.argv)
OSError: [Errno 13] Permission denied
After doing some searching around the web I found that one solution was to add the adb to my PATH variable. I added the platform-tools directory to my PATH and I'm still getting the same error. I went ahead to check the code that is causing the problem and apparently its this snippet:
adb = subprocess.Popen(getprop_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
where getprop_args is defined as follows:
getprop_args = ['adb', 'shell', 'getprop', 'ro.build.version.sdk']
From what I understand the code is trying to run the following command:
adb shell getprop ro.build.version.sdk
I ran the command in console and it work with no problem. I also copied both lines of code and ran them in python interpreter and it ran without a problem. I really don't know how to solve this issue. Does anyone know of a possible solution?
Ok so I found out what the problem was. The problem was the sudo that I was putting right before python systrace.py -o output.html I didn't know but I guess the PATH variable is different when using sudo, than when not using it. So the PATH in sudo didn't have the platform-tools directory. So I removed the sudo and I was getting the following error:
File "systrace.py", line 274, in <module>
main()
File "systrace.py", line 63, in main
os.execv(legacy_script, sys.argv)
OSError: [Errno 13] Permission denied
To solve this problem I ran the following command on the legacy_script:
$chmod +x ./systrace-legacy.py
And now I was able to run the systrace script without a problem :P
this problem is causing by PATH. adb path should put the end of the other path.
for example:
$ sudo gedit /etc/environment;
PATH="...:~/softAddr/adt-bundle-linux-x86_64-20140624/sdk/platform-tools:~/softAddr/adt-bundle-linux-x86_64-20140624/sdk/tools"
not:
PATH="~/softAddr/adt-bundle-linux-x86_64-20140624/sdk/platform-tools:~/softAddr/adt-bundle-linux-x86_64-20140624/sdk/tools:..."

Forge / Trigger.io cannot find adb even

Trying to run forge run android command and getting this error even though file is present (Ubuntu 12.04). Even if I do not specify the sdk path and allow forge to download it on its own, I am still getting the same error.
2012-07-04 15:08:36,414 [ DEBUG] Exception running detached command:
/home/rockyj/Apps/android-sdk-linux/platform-tools/adb start-server:
[Errno 2] No such file or directory while running
run_android(('/home/rockyj/Workspace/Projects/greeter/development',
u'/home/rockyj/Apps/android-sdk-linux', None, True, None), {})
2012-07-04 15:08:36,417 [ ERROR] Something went wrong that we didn't expect:
2012-07-04 15:08:36,417 [ ERROR] Exception running detached command:
/home/rockyj/Apps/android-sdk-linux/platform-tools/adb start-server:
[Errno 2] No such file or directory
2012-07-04 15:08:36,417 [ DEBUG] Traceback (most recent call last):
File "/home/rockyj/Apps/forge-tools/forge/async.py", line 87, in run
result = self._target(*self._args, **self._kwargs)
File "/home/rockyj/Apps/forge-tools/forge/main.py", line 388, in run
build_to_run=build_to_run,
File "/home/rockyj/Workspace/Projects/greeter/.template/generate_dynamic/customer_goals.py",
line 120, in run_app
build_to_run.run()
File "/home/rockyj/Workspace/Projects/greeter/.template/generate_dynamic/build.py",
line 338, in run
self._run_task(func_name, args, kw)
File "/home/rockyj/Workspace/Projects/greeter/.template/generate_dynamic/build.py",
line 293, in _run_task
self.tasks[func_name](self, *args, **kw)
File "/home/rockyj/Workspace/Projects/greeter/.template/generate_dynamic/android_tasks.py",
line 588, in run_android
run_detached([path_info.adb, 'start-server'], wait=True)
File "/home/rockyj/Workspace/Projects/greeter/.template/generate_dynamic/android_tasks.py",
line 377, in run_detached
raise ShellError(message="Exception running detached command: %s"
% full_command, output=str(output))
ShellError: Exception running detached command:
/home/rockyj/Apps/android-sdk-linux/platform-tools/adb start-server:
[Errno 2] No such file or directory
Please help.
Thanks.
Per the comments, this issue was fixed by installing ia32 libs on Ubuntu.

Categories

Resources