CommandFailedError when running systrace on Android 6.0 device - android
I want to capture a system trace, using the systrace tool.
I have this device (not-rooted) :
Pixi 4.5 Alcatel
Android 6.0 (API 23)
And I use Android Studio 4.2.2 and I have installed Python 2.7.18, as required (the version 3+ does not match).
Here is the command line to view the list of available categories on my device :
C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace>C:\Users\myUser\AppData\Local\Programs\Python27\python systrace.py -l
I chose this command with the -l option for my here question because it results (see below) in the expected list plus an extra set of lines which suggests that the error CommandFailedError is related to an exception on HasRoot :
gfx - Graphics
input - Input
view - View System
webview - WebView
wm - Window Manager
am - Activity Manager
sm - Sync Manager
audio - Audio
video - Video
camera - Camera
hal - Hardware Modules
app - Application
res - Resource Loading
dalvik - Dalvik VM
rs - RenderScript
hwui - HWUI
perf - Performance
bionic - Bionic C Library
power - Power Management
sched - CPU Scheduling
freq - CPU Frequency
idle - CPU Idle
load - CPU Load
CRITICAL:root:(TimeoutThread-1-for-MainThread) Exception on HasRoot(myDeviceId, retries=3, timeout=30), attempt 1 of 4: CommandFailedError("(device: myDeviceId) one line of output was expected, but got: ['uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcar
d_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0', '']",)
CRITICAL:root:(TimeoutThread-2-for-MainThread) Exception on HasRoot(myDeviceId, retries=3, timeout=30), attempt 2 of 4: CommandFailedError("(device: myDeviceId) one line of output was expected, but got: ['uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcar
d_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0', '']",)
CRITICAL:root:(TimeoutThread-3-for-MainThread) Exception on HasRoot(myDeviceId, retries=3, timeout=30), attempt 3 of 4: CommandFailedError("(device: myDeviceId) one line of output was expected, but got: ['uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcar
d_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0', '']",)
Traceback (most recent call last):
File "systrace.py", line 49, in <module>
sys.exit(run_systrace.main())
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 205, in main
main_impl(sys.argv)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 177, in main_impl
atrace_agent.list_categories(options)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\tracing_agents\atrace_agent.py", line 65, in list_categories
if not devutils.HasRoot():
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 63, in timeout_r
etry_wrapper
impl, timeout, retries, desc=desc, retry_if_func=retry_if_func)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 164, in Run
error_log_func=error_log_func)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 199, in JoinA
ll
self._JoinAll(watcher, timeout)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 171, in _Join
All
thread.ReraiseIfException()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 94, in run
self._ret = self._func(*self._args, **self._kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 156, in <lambda
>
lambda: func(*args, **kwargs), name=thread_name)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 51, in impl
return f(*args, **kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\device_utils.py", line 562, in HasRoo
t
output = self.RunShellCommand(['id'], single_line=True)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 56, in timeout_r
etry_wrapper
return impl()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 51, in impl
return f(*args, **kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\device_utils.py", line 1556, in RunSh
ellCommand
raise device_errors.CommandFailedError(msg % output, str(self))
devil.android.device_errors.CommandFailedError: (device: myDeviceId) one line of output was expected, but got: ['uid=2000(shell) gid=2000(shell) groups=2000(
shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0', '']
By comparison, here is the error CommandFailedError obtained with a command which should generate an html report :
C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace>C:\Users\myUser\AppData\Local\Programs\Python27\python systrace.py
Traceback (most recent call last):
File "systrace.py", line 49, in <module>
sys.exit(run_systrace.main())
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 205, in main
main_impl(sys.argv)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 185, in main_impl
controller.StartTracing()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py", line 46, in StartTracing
self._tracing_controller.StartTracing()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\tracing_controller.py", line 156, in StartTracing
timeout=self._controller_config.timeout):
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\__init__.py", line 103, in RunWithTimeout
return timeout_retry.Run(func, timeout, 0, args=args)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 164, in Run
error_log_func=error_log_func)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 199, in JoinA
ll
self._JoinAll(watcher, timeout)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 171, in _Join
All
thread.ReraiseIfException()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 94, in run
self._ret = self._func(*self._args, **self._kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 156, in <lambda
>
lambda: func(*args, **kwargs), name=thread_name)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\tracing_agents\android_cgroup_agent.py", line 59, in StartAgent
Tracing
if not self._device_utils.HasRoot():
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 56, in timeout_r
etry_wrapper
return impl()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 51, in impl
return f(*args, **kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\device_utils.py", line 562, in HasRoo
t
output = self.RunShellCommand(['id'], single_line=True)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 56, in timeout_r
etry_wrapper
return impl()
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 51, in impl
return f(*args, **kwargs)
File "C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\device_utils.py", line 1556, in RunSh
ellCommand
raise device_errors.CommandFailedError(msg % output, str(self))
devil.android.device_errors.CommandFailedError: (device: deviceId) one line of output was expected, but got: ['uid=2000(shell) gid=2000(shell) groups=2000(
shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0', '']
I am sure that there is a proper way to run systrace on an old unrooted device but I just didn't find it.
Does anyone have a clue or a solution? Thanks.
EDIT :
Thanks a lot for your analysis and your answer #yi-yang.
As you recommended, I set single_line to False in the RunShellCommand call. Furthermore, I also modified the return line, which gives the final code in the device_utils.py file, lines 562-563 :
output = self.RunShellCommand(['id'], single_line=False)
return output[0].startswith('uid=0(root)')
Note that I select the first line because there are still two lines, which means that some optional newline at the end needs to be stripped somehow...
Now it works but only for a few categories, as in the following example:
systrace.py -o mynewtrace.html perf idle load
However, for any atrace data, including the very helpful "sched" (see atrace_agent.py), the cpu profiling not possible, as shown by the following messages:
Warning: Only 2 of 3 tracing agents started.
IOError('Unable to get atrace data. Did you forget adb root?')
So the root privileges do matter, despite what the file comments (l. 556-558) claim :-(.
I guess rooting is a must for the full experience!
Related
Systrace fails with "Permission Denied"
When I try to run Systrace, i get this stacktrace: python systrace.py --app=com.mydebug.app view gfx sched dalvik wm Starting tracing (stop with enter) Tracing completed. Collecting output... CRITICAL:root:(TimeoutThread-1-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 1 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpyO_hQZ/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpyO_hQZ/tmp_ReadFileWithPull': remote Permission denied\n",) CRITICAL:root:(TimeoutThread-2-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 2 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpVakBVH/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpVakBVH/tmp_ReadFileWithPull': remote Permission denied\n",) CRITICAL:root:(TimeoutThread-3-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 3 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmp_IoryO/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmp_IoryO/tmp_ReadFileWithPull': remote Permission denied\n",) Exception in thread Thread-1: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 194, in _collect_and_preprocess trace_data = self._collect_trace_data() File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 261, in _collect_trace_data self._stop_trace() File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 244, in _stop_trace if int(self._device_utils.ReadFile(is_trace_enabled_file)): File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 57, in timeout_retry_wrapper retry_if_func=retry_if_func) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/timeout_retry.py", line 159, in Run error_log_func=error_log_func) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 186, in JoinAll self._JoinAll(watcher, timeout) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 158, in _JoinAll thread.ReraiseIfException() File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 81, in run self._ret = self._func(*self._args, **self._kwargs) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/timeout_retry.py", line 152, in <lambda> child_thread = reraiser_thread.ReraiserThread(lambda: func(*args, **kwargs), File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 47, in impl return f(*args, **kwargs) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/device_utils.py", line 1658, in ReadFile return self._ReadFileWithPull(device_path) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/device_utils.py", line 1610, in _ReadFileWithPull self.adb.Pull(device_path, host_temp_path) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 454, in Pull self._RunDeviceAdbCmd(cmd, timeout, retries) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 282, in _RunDeviceAdbCmd check_error=check_error) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 51, in timeout_retry_wrapper return impl() File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 47, in impl return f(*args, **kwargs) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 258, in _RunAdbCmd args, output, status, device_serial) AdbCommandFailedError: (device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpw7qK2c/tmp_ReadFileWithPull: failed with exit status 1 and output: - adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpw7qK2c/tmp_ReadFileWithPull': remote Permission denied Outputting Systrace results... Tracing complete, writing results Traceback (most recent call last): File "systrace.py", line 49, in <module> sys.exit(run_systrace.main()) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 194, in main main_impl(sys.argv) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 191, in main_impl controller.OutputSystraceResults(write_json=options.write_json) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/systrace_runner.py", line 67, in OutputSystraceResults self._out_filename) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/output_generator.py", line 70, in GenerateHTMLOutput html_file.write(_ConvertToHtmlString(result.raw_data)) File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/output_generator.py", line 92, in _ConvertToHtmlString raise ValueError('Invalid trace result format for HTML output') ValueError: Invalid trace result format for HTML output I can adb pull files off my sdcard though. I've tried running systrace from my android-sdk platform-tools, and I've tried running systrace cloned from the catapult git repo but I get the same error. Is it not possible to run systrace on production devices?? What's peculiar is that I can successfully run systrace using the Android Device Monitor, but I don't like how it forces me to put in a time unlike the command line tool. Also, no matter what time and buffer size I choose when running systrace through the Device Monitor it always records for 5 seconds only.
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 on Chromium ARC Compilation when configure
Getting errors as below, when I follow step 4 of the instruction from Getting Started with ARC Open Source on Linux. OS is Ubuntu 14.04 LTS running in Hyper-V. UBUNTU14:~/arc$ ./configure ERROR:root:While running ['third_party/tools/depot_tools/third_party/gsutil/gsutil', 'cp', 'gs://arc-build/naclports/builds/pepper_40/python.zip', '/tmp/tmpUZ0IoK/naclports-python'] ERROR:root:GSResponseError: status=403, code=None, reason=Forbidden. ERROR:root:Try prodaccess, and if it does not solve the problem try rm ~/.devstore_token ###STEP_WARNINGS### ERROR:root:Retrying after 9 s sleeping Traceback (most recent call last): File "/home/fkiller/arc/src/build/build_common.py", line 938, in wrapper return func(*args, **kwargs) File "/home/fkiller/arc/src/build/util/download_package_util.py", line 243, in _download_package_with_retries self._download_method(url, download_package_path) File "/home/fkiller/arc/src/build/util/download_package_util.py", line 119, in _download build_common.get_gsutil_executable(), 'cp', url, destination_path]) File "/home/fkiller/arc/src/build/util/download_package_util.py", line 97, in execute_subprocess output = subprocess.check_output(cmd, cwd=cwd, stderr=subprocess.STDOUT) File "/usr/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output) CalledProcessError: Command '['third_party/tools/depot_tools/third_party/gsutil/gsutil', 'cp', 'gs://arc-build/naclports/builds/pepper_40/python.zip', '/tmp/tmpUZ0IoK/naclports-python']' returned non-zero exit status 1 Any idea to resolve this without changing build script? I may manually pointing python.zip from other sources such as https://naclports.storage.googleapis.com/builds/pepper_40/trunk-147-g49eb4c9/publish/python/pnacl/python.zip, but I want to build it as is without changing scripts. I've already tried to setup gsutil and its authenticator, but it didn't fix the issue. EDIT: After #elijah-taylor fixed ACL, now I'm getting errors below Traceback (most recent call last): File "src/build/configure.py", line 365, in sys.exit(main()) File "src/build/configure.py", line 347, in main _gclient_sync_third_party() File "src/build/configure.py", line 132, in _gclient_sync_third_party subprocess.check_output(cmd, cwd=os.path.dirname(gclient_filename)) File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs) 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 In the line 132, File "src/build/configure.py", line 132, in _gclient_sync_third_party subprocess.check_output(cmd, cwd=os.path.dirname(gclient_filename)) gclient_filename is "third_party/.gclient" and os.path.dirname(gclient_filename) is "thrid_party".
The problem was bad ACLs on the files. I reached out to #elijah-taylor for a fix, it should now work!
faced same issue..fixed after running the following. apt-get install gsutil apt-get install libwww-perl chmod +x ./third_party/tools/depot_tools/third_party/gsutil/gsutil
[Android,Facebook,Infer]Too many open files about infer error
I use Facebook's Infer to check my android code infer -- ./gradlew build after 8 minutes Fatal error: exception Sys_error("/Users/lm/project/android_workplace/******/app/build/intermediates/exploded-aar/com.mogujie/user/1.2.17/jars/classes.jar: Too many open files") Traceback (most recent call last): File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/infer", line 180, in <module> main() File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/infer", line 144, in main capture_exitcode = imported_module.gen_instance(args, cmd).capture() File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/capture/gradle.py", line 83, in capture return util.run_commands(cmds) File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/capture/util.py", line 40, in run_commands if not cmd.start(): File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 692, in start if self.capture() == os.EX_OK: File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 478, in capture return self.run_infer_frontend() File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 469, in run_infer_frontend self.args.analyzer File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 385, in run_command raise e subprocess.CalledProcessError: Command '[u'/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/InferJava', u'-project_root', '/Users/lm/project/android_workplace/Minicooper4android', u'-results_dir', u'/Users/lm/project/android_workplace/Minicooper4android/infer-out', u'-verbose_out', '/var/folders/2r/7hc18jz1091_jg7_8jcnqlhr0000gn/T/javac_qWbfkP.out', u'-models', u'/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/java/models.jar', u'-no-static_final']' returned non-zero exit status 2
From http://fbinfer.com/support The maximum number of files a program can simultaneously hold open is a bit low on MacOs. You can increase the limit by running these commands for example: sysctl -w kern.maxfiles=20480 sysctl -w kern.maxfilesperproc=22480 ulimit -S -n 2048
Error when trying to use android systrace.py line 135
New to android and wanted to do a little debugging with the systrace tool however I am unable to run the tool on the emulator (tried running the python script with python 2.0.1, 2.7.x, 3.x) as well as using ADT. However they all produce different errors: Developers | Systrace claims that it requires 2.x so using Python 2.x and executing python command systrace.py --help, I get: C:\Development\Android\sdk\platform-tools\systrace>python systrace.py --help Traceback (most recent call last): File "systrace.py", line 286, 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 "C:\Reuben\Softwares\Python 2.7.6\Lib\subprocess.py", line 709, in __init__ errread, errwrite) File "C:\Reuben\Softwares\Python 2.7.6\Lib\subprocess.py", line 957, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified C:\Development\Android\sdk\platform-tools\systrace>python systrace.py --help File "systrace.py", line 135 css = '\n'.join(linked_css_tag % (os.path.join(src_dir, f)) for f in css_files) ^ SyntaxError: invalid syntax But with Admin permission: C:\Development\Android\sdk\platform-tools\systrace>systrace.py --help File "C:\Development\Android\sdk\platform-tools\systrace\systrace.py", line 135 css = '\n'.join(linked_css_tag % (os.path.join(src_dir, f)) for f in css_files) ^ SyntaxError: invalid syntax With ADT settings Error dialog Other Relevant Information: Enabled: Android Debugging, Profile GPU rendering Enable OpenGL traces: Systrace (Graphics) Enable traces: Graphics,Input Tried Other solution but got "mount: Device or resource busy"