Project Android compilation failed on EC2 instance - android

I use an EC2 instance (Ubuntu), and I want launch gradlew in my Android project, through the Terminal.
But I have this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not download artifact 'maven-ant-tasks.jar (org.apache.maven:maven-ant-tasks:2.1.3)'
> Failed to download resource 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
> No space left on device
I checked the space, and Inodes and all is ok:
root#ip-xx-xx-xx-xx:/home/mytest/sandbox/MyApplication# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 99G 12G 83G 13% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 492M 12K 492M 1% /dev
tmpfs 100M 324K 99M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 497M 0 497M 0% /run/shm
none 100M 0 100M 0% /run/user
overflow 1.0M 0 1.0M 0% /tmp
root#ip-xx-xx-xx-xx:/home/mytest/sandbox/MyApplication# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/xvda1 6553600 241915 6311685 4% /
none 127032 2 127030 1% /sys/fs/cgroup
udev 125790 403 125387 1% /dev
tmpfs 127032 307 126725 1% /run
none 127032 1 127031 1% /run/lock
none 127032 1 127031 1% /run/shm
none 127032 2 127030 1% /run/user
overflow 127032 4 127028 1% /tmp
If I download manually this jar (maven-ant-tasks-2.1.3.jar) with wget command, the download is successful.
I tried with sudo privileges, and the same error appears (No space left on device).
Previously, I followed these explanations, to be sure about the space : EC2 instance on Amazon and I am greeted with "No space left on the disk". Again, the same error appears (No space left on device).
Thank you for your help guys!

Related

how can i fix this error on React-native project on Appcenter?

I've tryed to bluid on the appcenter the app, this was my first error was the version of JAVA( Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.), so I installed the https://www.azul.com/downloads/?package=jdk
and now i'm facing this error:
##[section]Starting: Build
##[section]Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'Mac-1675090393322'
Current agent version: '2.214.1'
##[group]Operating System
macOS
11.7.2
20G1020
##[endgroup]
##[group]Runner Image
Image: macos-11
Version: 20230117.2
Included Software: https://github.com/actions/runner-images/blob/macOS-11/20230117.2/images/macos/macos-11-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macOS-11%2F20230117.2
##[endgroup]
##[group]Runner Image Provisioner
2.0.98.1
##[endgroup]
Current image version: '20230117.2'
Agent running as: 'runner'
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: PowerShell (2.212.0)
Downloading task: Bash (3.214.0)
Downloading task: CmdLine (1.1.3)
Downloading task: ShellScript (2.212.0)
Downloading task: CmdLine (2.212.0)
Downloading task: Gradle (1.128.0)
Downloading task: CopyFiles (2.211.0)
Downloading task: PublishBuildArtifacts (1.211.0)
Downloading task: AppCenterDistribute (3.214.0)
Checking job knob settings.
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Finished checking job knob settings.
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Checkout app-mobile#staging to s
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Syncing repository: app-mobile (ExternalGit)
##[command]git version
git version 2.39.1
##[command]git lfs version
git-lfs/3.3.0 (GitHub; darwin amd64; go 1.19.3)
##[command]git init "/Users/runner/work/1/s"
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
Initialized empty Git repository in /Users/runner/work/1/s/.git/
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
##[command]git remote add origin https://github.com/test-io/app-mobile.git
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/test-io/app-mobile.git.extraheader
##[command]git config --get-all http.extraheader
##[command]git config --get-regexp .*extraheader
##[command]git config --get-all http.proxy
##[command]git config http.version HTTP/1.1
##[command]git remote set-url origin https://***:***#github.com/test-io/app-mobile.git
##[command]git remote set-url --push origin https://***:***#github.com/test-io/app-mobile.git
##[command]git lfs install --local
Updated Git hooks.
Git LFS initialized.
##[command]git config remote.origin.lfsurl https://***:***#github.com/test-io/app-mobile.git/info/lfs
##[command]git config remote.origin.lfspushurl https://***:***#github.com/test-io/app-mobile.git/info/lfs
##[command]git fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin
remote: Enumerating objects: 7768, done.
remote: Counting objects: 0% (1/1501)
remote: Counting objects: 1% (16/1501)
remote: Counting objects: 2% (31/1501)
remote: Counting objects: 3% (46/1501)
remote: Counting objects: 4% (61/1501)
remote: Counting objects: 5% (76/1501)
remote: Counting objects: 6% (91/1501)
remote: Counting objects: 7% (106/1501)
remote: Counting objects: 8% (121/1501)
remote: Counting objects: 9% (136/1501)
remote: Counting objects: 10% (151/1501)
remote: Counting objects: 11% (166/1501)
remote: Counting objects: 12% (181/1501)
remote: Counting objects: 13% (196/1501)
remote: Counting objects: 14% (211/1501)
remote: Counting objects: 15% (226/1501)
remote: Counting objects: 16% (241/1501)
remote: Counting objects: 17% (256/1501)
remote: Counting objects: 18% (271/1501)
remote: Counting objects: 19% (286/1501)
remote: Counting objects: 20% (301/1501)
remote: Counting objects: 21% (316/1501)
remote: Counting objects: 22% (331/1501)
remote: Counting objects: 23% (346/1501)
remote: Counting objects: 24% (361/1501)
remote: Counting objects: 25% (376/1501)
remote: Counting objects: 26% (391/1501)
remote: Counting objects: 27% (406/1501)
remote: Counting objects: 28% (421/1501)
remote: Counting objects: 29% (436/1501)
remote: Counting objects: 30% (451/1501)
remote: Counting objects: 31% (466/1501)
remote: Counting objects: 32% (481/1501)
remote: Counting objects: 33% (496/1501)
remote: Counting objects: 34% (511/1501)
remote: Counting objects: 35% (526/1501)
remote: Counting objects: 36% (541/1501)
remote: Counting objects: 37% (556/1501)
remote: Counting objects: 38% (571/1501)
remote: Counting objects: 39% (586/1501)
remote: Counting objects: 40% (601/1501)
remote: Counting objects: 41% (616/1501)
remote: Counting objects: 42% (631/1501)
remote: Counting objects: 43% (646/1501)
remote: Counting objects: 44% (661/1501)
remote: Counting objects: 45% (676/1501)
remote: Counting objects: 46% (691/1501)
remote: Counting objects: 47% (706/1501)
remote: Counting objects: 48% (721/1501)
remote: Counting objects: 49% (736/1501)
remote: Counting objects: 50% (751/1501)
remote: Counting objects: 51% (766/1501)
remote: Counting objects: 52% (781/1501)
remote: Counting objects: 53% (796/1501)
remote: Counting objects: 54% (811/1501)
remote: Counting objects: 55% (826/1501)
remote: Counting objects: 56% (841/1501)
remote: Counting objects: 57% (856/1501)
remote: Counting objects: 58% (871/1501)
remote: Counting objects: 59% (886/1501)
remote: Counting objects: 60% (901/1501)
remote: Counting objects: 61% (916/1501)
remote: Counting objects: 62% (931/1501)
remote: Counting objects: 63% (946/1501)
remote: Counting objects: 64% (961/1501)
remote: Counting objects: 65% (976/1501)
remote: Counting objects: 66% (991/1501)
remote: Counting objects: 67% (1006/1501)
remote: Counting objects: 68% (1021/1501)
remote: Counting objects: 69% (1036/1501)
remote: Counting objects: 70% (1051/1501)
remote: Counting objects: 71% (1066/1501)
remote: Counting objects: 72% (1081/1501)
remote: Counting objects: 73% (1096/1501)
remote: Counting objects: 74% (1111/1501)
remote: Counting objects: 75% (1126/1501)
remote: Counting objects: 76% (1141/1501)
remote: Counting objects: 77% (1156/1501)
remote: Counting objects: 78% (1171/1501)
remote: Counting objects: 79% (1186/1501)
remote: Counting objects: 80% (1201/1501)
remote: Counting objects: 81% (1216/1501)
remote: Counting objects: 82% (1231/1501)
remote: Counting objects: 83% (1246/1501)
remote: Counting objects: 84% (1261/1501)
remote: Counting objects: 85% (1276/1501)
remote: Counting objects: 86% (1291/1501)
remote: Counting objects: 87% (1306/1501)
remote: Counting objects: 88% (1321/1501)
remote: Counting objects: 89% (1336/1501)
remote: Counting objects: 90% (1351/1501)
remote: Counting objects: 91% (1366/1501)
remote: Counting objects: 92% (1381/1501)
remote: Counting objects: 93% (1396/1501)
remote: Counting objects: 94% (1411/1501)
remote: Counting objects: 95% (1426/1501)
remote: Counting objects: 96% (1441/1501)
remote: Counting objects: 97% (1456/1501)
remote: Counting objects: 98% (1471/1501)
remote: Counting objects: 99% (1486/1501)
remote: Counting objects: 100% (1501/1501)
remote: Counting objects: 100% (1501/1501), done.
remote: Compressing objects: 100% (570/570), done.
Receiving objects: 98% (7613/7768)
remote: Total 7768 (delta 989), reused 1125 (delta 913), pack-reused 6267
Receiving objects: 100% (7768/7768), 13.60 MiB | 27.15 MiB/s, done.
Resolving deltas: 100% (4515/4515), done.
From https://github.com/test-io/app-mobile
* [new branch] dev -> origin/dev
* [new branch] develop_bk -> origin/develop_bk
* [new branch] fix-npm-build-error -> origin/fix-npm-build-error
* [new branch] fixIntermediateStops -> origin/fixIntermediateStops
* [new branch] main -> origin/main
* [new branch] pick-up-point -> origin/pick-up-point
* [new branch] staging -> origin/staging
##[command]git checkout 7887c0f5c3331ddf80738738a721561dca8ac8a0 -- .lfsconfig
error: pathspec '.lfsconfig' did not match any file(s) known to git
##[command]git lfs fetch origin 7887c0f5c3331ddf80738738a721561dca8ac8a0
fetch: Fetching reference 7887c0f5c3331ddf80738738a721561dca8ac8a0
##[command]git checkout --progress --force 7887c0f5c3331ddf80738738a721561dca8ac8a0
HEAD is now at 7887c0f Merge branch 'staging' of https://github.com/test-io/app-mobile into staging
##[command]git submodule sync --recursive
##[command]git submodule update --init --force --recursive
##[command]git remote set-url origin https://github.com/test-io/app-mobile.git
##[command]git remote set-url --push origin https://github.com/test-io/app-mobile.git
##[command]git config --unset-all remote.origin.lfsurl
##[command]git config --unset-all remote.origin.lfspushurl
##[section]Finishing: Checkout app-mobile#staging to s
##[section]Starting: Install build scripts
==============================================================================
Task : PowerShell
Description : Run a PowerShell script on Linux, macOS, or Windows
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
[command]/usr/local/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/Users/runner/work/_temp/60981a72-50ee-4163-a24c-89ee83d5914e.ps1'
Reinstalling Gradle init script plugins from /Users/runner/runners/2.214.1/scripts/gradle-init-script-plugins...
##[section]Finishing: Install build scripts
##[section]Starting: Select Node.js Version v2
==============================================================================
Task : Bash
Description : Run a Bash script on macOS, Linux, or Windows
Version : 3.214.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Formatted command: exec bash '/Users/runner/runners/2.214.1/scripts/select-node-version.sh' node16
========================== Starting Command Output ===========================
[command]/bin/bash /Users/runner/work/_temp/5fb58e04-a0b5-4a75-9f03-271e187e5641.sh
v16.19.0 is already installed.
Now using node v16.19.0 (npm v8.19.3)
default -> v16.19.0 *
Node version: v16.19.0
npm version: 8.19.3
##[section]Finishing: Select Node.js Version v2
##[section]Starting: yarn/npm install
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
[command]/bin/sh -c if [ -f yarn.lock ]; then { yarn install --network-timeout=600000 && yarn list --depth=0; } else npm install; fi
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:2298) Warning: Use Cipheriv for counter mode of aes-256-ctr
npm WARN deprecated w3c-hr-time#1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated stable#0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated sane#4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uglify-es#3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated babel-eslint#10.1.0: babel-eslint is now #babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated #react-native-community/masked-view#0.1.11: Repository was moved to #react-native-masked-view/masked-view
npm WARN deprecated #aws-amplify/ui#2.0.7: Versions '1.x' and '2.x' of '#aws-amplify/ui' have been deprecated. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid#3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
added 2236 packages, and audited 2237 packages in 1m
156 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
##[section]Finishing: yarn/npm install
##[section]Starting: Pre Build Script
==============================================================================
Task : Shell script
Description : Run a shell script using Bash
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/shell-script
==============================================================================
##[error]Not found scriptPath: /Users/runner/work/1/s/appcenter-pre-build.sh
##[error]Bash failed with error: Not found scriptPath: /Users/runner/work/1/s/appcenter-pre-build.sh
##[section]Finishing: Pre Build Script
##[section]Starting: Checkout app-mobile#staging to s
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: app-mobile (ExternalGit)
##[section]Finishing: Checkout app-mobile#staging to s
##[section]Starting: Finalize Job
Cleaning up task key
Start cleaning up orphan processes.
##[section]Finishing: Finalize Job
##[section]Finishing: Build
I've tried to add this org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home on my gradle.properties
The AppCenter build runner has predefined some variables for users to configure their build with.
You can set the JAVA_HOME environment variable to $(JAVA_HOME_11_X64) in your build config on AppCenter.

Customize /system mountpoint on Android

I'm trying to change a Nexus 5 to use dm-verity module. For that I need to:
invoke an utility called veritysetup during boot before /system is mounted;
(this utility will will create a new device called /dev/mapper/devname);
let /system be mounted on /dev/mapper/devname, not the actual partition.
It looks like the mountpoint is configured on fstab.hammerhead (device/lge/hammerhead). In fact I have another mod working by changing this file. So this seams like the easy part.
I know some filesystems are mounted by init.c (system/core/init), like /dev and /proc, and some are mounted on init.hammerhead (system/core/rootdir), like /acct. But I can find where the request to mount /system is.
Any ideas?
That's not the correct way to do it. To use dm-verity we need to:
build android using "user" build type (default is "eng");
change fstab to include "verify" keyword on fs_mgr_flags.
So, when Android the vold module will find the verity flag and will create the mapper device.
If the system image has a signed hash table and precomputed hash and the root image has the public key everything should just work. We should find that the system partition was mounted on /dev/block/dm-0 instead of /dev/block/platform/msm_sdcc.1/by-name/system and is being verified while being read.
I am having a similar inquiry and the posted answer here is closest related post I have found, certaintly my inquiry is relavant...
Does anyone know where the code that generates or places the fstab files into the stage1 and stage2 boots is, I think there is a bug or missing file somewhere. I can easily change and update things. What file in AOSP actually needs to be edited before building in order to modify or make changes in the fstab file before it is packed into he ramfs stage 1 or stage 2. Also where do I place kernel debug parameters like "pci=nocrs" ?
*Note: The answer accepted here is the correct answer per the aosp source documentation, but it leaves out the same valuable information the source documentation does. Where does the file need to be placed in the tree before running the build I can see the output does have vendor folder with a couple versions of fstab, but I am not sure where it was placed in the boot images.
I would like to boot this in qemu kvm with the cuttlefish build.
Full kernel.log file here: https://pastebin.com/9MKFKeyN
Intresting part below:
[ 1.702829] init: Switching root to '/first_stage_ramdisk'
[ 1.703038] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 1.703574] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 1.712562] init: [libfs_mgr]Invalid ext4 superblock on '/dev/block/by-name/metadata'
[ 1.712864] traps: init[1] trap invalid opcode ip:41a6eb sp:7ffff59c93e0 error:0 in init[2f7000+200000]
[ 1.713197] init: InitFatalReboot: signal 4
[ 1.713574] init: #00 pc 000000000031b86b /init
[ 1.713626] init: Reboot ending, jumping to kernel
[ 1.713718] kvm: exiting hardware virtualization
[ 1.788726] reboot: Restarting system with command 'bootloader'
[ 1.788872] reboot: machine restart
Latest AOSP build as of 4/2/2022
buildprops
aosp/out/target/product/vsoc_x86_64/ramdisk/system/etc/ramdisk/build.prop
####################################
# from generate-common-build-props
# These properties identify this partition image.
####################################
ro.product.bootimage.brand=generic
ro.product.bootimage.device=vsoc_x86_64
ro.product.bootimage.manufacturer=Google
ro.product.bootimage.model=Cuttlefish x86_64 tv
ro.product.bootimage.name=aosp_cf_x86_64_tv
ro.bootimage.build.date=Sat Apr 2 12:06:36 CDT 2022
ro.bootimage.build.date.utc=1648919196
ro.bootimage.build.fingerprint=generic/aosp_cf_x86_64_tv/vsoc_x86_64:Tiramisu/AOSP.MASTER/me04021206:userdebug/test-keys
ro.bootimage.build.id=AOSP.MASTER
ro.bootimage.build.tags=test-keys
ro.bootimage.build.type=userdebug
ro.bootimage.build.version.incremental=eng.me.20220402.120943
ro.bootimage.build.version.release=12
ro.bootimage.build.version.release_or_codename=Tiramisu
ro.bootimage.build.version.sdk=32
# end of file
fstab.ext4
/genvol/aosp/out/target/product/vsoc_x86_64/recovery/root/first_stage_ramdisk/fstab.ext4
# Non-dynamic, boot critical partitions
/dev/block/by-name/boot /boot emmc defaults recoveryonly,slotselect,first_stage_mount,avb=boot
/dev/block/by-name/init_boot /init_boot emmc defaults recoveryonly,slotselect,first_stage_mount,avb=init_boot
/dev/block/by-name/vendor_boot /vendor_boot emmc defaults recoveryonly,slotselect
system /system erofs ro wait,logical,first_stage_mount,slotselect,avb=vbmeta_system,avb_keys=/avb
system /system ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta_system,avb_keys=/avb
# Add all non-dynamic partitions except system, after this comment
/dev/block/by-name/userdata /data ext4 nodev,noatime,nosuid,errors=panic latemount,wait,check,quota,formattable,fileencryption=aes-256-xts:aes-256-cts,keydirectory=/metadata/vold/metadata_encryption,checkpoint=block
/dev/block/by-name/metadata /metadata ext4 nodev,noatime,nosuid,errors=panic wait,formattable,first_stage_mount,check
/dev/block/by-name/misc /misc emmc defaults defaults
# Add all dynamic partitions except system, after this comment
odm /odm erofs ro wait,logical,first_stage_mount,slotselect,avb
odm /odm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb
product /product erofs ro wait,logical,first_stage_mount,slotselect,avb
product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb
system_ext /system_ext erofs ro wait,logical,first_stage_mount,slotselect,avb=vbmeta_system
system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta_system
vendor /vendor erofs ro wait,logical,first_stage_mount,slotselect,avb=vbmeta
vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta
vendor_dlkm /vendor_dlkm erofs ro wait,logical,first_stage_mount,slotselect,avb
vendor_dlkm /vendor_dlkm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb
odm_dlkm /odm_dlkm erofs ro wait,logical,first_stage_mount,slotselect,avb
odm_dlkm /odm_dlkm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb
system_dlkm /system_dlkm erofs ro wait,logical,first_stage_mount,slotselect,avb=vbmeta
system_dlkm /system_dlkm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta
# ZRAM, SD-Card and virtiofs shares
/dev/block/zram0 none swap defaults zramsize=75%
/dev/block/vdc1 /sdcard vfat defaults recoveryonly
/devices/*/block/vdc auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
shared /mnt/vendor/shared virtiofs nosuid,nodev,noatime nofail
I also have full kernel log and other information if it will help, Vtd and Vtx are working and all of the pci show in the IOMMU Groups.
acloud create --local-instance 1 --local-image tells me how to start troubleshooting when it fails, only after you manually build the certfile as that part of the acloud setup for instance1 cannot complete, I found that error, but have not yet fixed the source for it, that one was simple - Manually created the cert allowed it to proceed but fails at the switchroot in the boot. All the hardware and qemu all showed good.
A few points of interest as cannot add full kernel.log
Waiting for AVD(s) to boot up ...stop_cvd I 04-02 17:33:50 137759 137759 main.cc:162] Successfully stopped device cvd-1: 0.0.0.0:6520
Fail! (453s)
Total time: (453s)
Device summary:
Fail in:
Cannot create cuttlefish instance: Device did not boot within 450 secs. Stderr:
The following files contain useful debugging information:
Serial console is disabled; use -console=true to enable it.
Kernel log: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/kernel.log
Logcat output: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/logs/logcat
Launcher log: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/logs/launcher.log
Instance configuration: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/cuttlefish_config.json
Instance environment: /tmp/acloud_cvd_temp/local-instance-1/.cuttlefish.sh
Failed to read a complete exit code, read 0 bytes only instead of the expected 4
VIRTUAL_DEVICE_BOOT_FAILED
launch_cvd E 04-02 17:33:50 115944 115944 main.cc:252] run_cvd returned 10
For more detail: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/launcher.log
Encountered the following errors:
Cannot create cuttlefish instance: Device did not boot within 450 secs. Stderr:
The following files contain useful debugging information:
Serial console is disabled; use -console=true to enable it.
Kernel log: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/kernel.log
Logcat output: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/logs/logcat
Launcher log: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/logs/launcher.log
Instance configuration: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/instances/cvd-1/cuttlefish_config.json
Instance environment: /tmp/acloud_cvd_temp/local-instance-1/.cuttlefish.sh
Failed to read a complete exit code, read 0 bytes only instead of the expected 4
VIRTUAL_DEVICE_BOOT_FAILED
launch_cvd E 04-02 17:33:50 115944 115944 main.cc:252] run_cvd returned 10
For more detail: /tmp/acloud_cvd_temp/local-instance-1/cuttlefish_runtime/launcher.log
If you have any question or need acloud team support, please feel free to contact us by email at buganizer-system+419709#google.com.
Line 227 of kernel log: [ 0.318334] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug

How to get higher precision of "CPU%" than that from TOP command?

When I use TOP command, I could get the following info:
shell#android:/ $ top -n 1
User 31%, System 10%, IOW 0%, IRQ 0%
User 346 + Nice 10 + Sys 120 + Idle 637 + IOW 6 + IRQ 0 + SIRQ 2 = 1121
PID PR CPU% S #THR VSS RSS PCY UID Name
481 1 26% S 89 762832K 81688K fg system system_server
1699 0 5% S 27 676472K 39092K fg u0_a72 wm.cs.systemmonitor
11243 0 3% S 28 673140K 29796K bg u0_a111 com.weather.Weather
13327 2 1% S 23 680472K 35844K bg u0_a83 com.rhmsoft.fm
659 0 1% S 17 663044K 33136K bg u0_a13 android.process.media
20260 1 0% R 1 1208K 508K shell top
We can see the CPU% is round to integer, is there any way I could get a process's CPU% with higher precision?
-- Clarifications on the bounty -- Alex
The question refers to Android system, and preferably to a non-rooted device. While Android provides advanced profiling techniques for Java applications, tools for native code (C++) are limited. top command on Android allows to show the statistics for all threads running in the system, both Java threads and C++ threads. I am looking for an answer that will help with the following quest:
My app uses 2% CPU when it is inactive in background, while it should be below 0.1%. If I run top -t, I get 0% for all 15 threads that belong to my process (some threads are Java threads, e.g. the Main, UI thread; others are pthreads that never attach to JVM). How can I guess which thread eats the battery?
I would be glad to get even more details about this unexpected activity, and Android provides great helpers like TraceView for Java threads. Any insight regarding tools for native code will be highly appreciated.
You didn't mention it in your post, but in the comment you said that you really need CPU utilization per thread, not per process.
If you can't find a tool that's accurate enough, you can look directly in /proc/[pid]/task/[ThreadName] as described in the man page for /proc. This gives total CPU time consumed in "clock ticks" since execution began. Getting better resolution than this is probably difficult or impossible.
Edit
From the OP's comment, a command that lists the relevant information is:
adb shell cat /proc/${pid}/task/*/stat | awk -F\ '{print $1, $14}'
This just cats the correct /proc files to the debugging host, which runs a tiny awk program to print the columns for pid and user time. You could also easily use cut -d " " -f1,14 or something similar in perl to get the columns if awk isn't available.
Try this:
ps -eo pcpu,pid,user,args | sort -r -k1 | less
%CPU PID USER COMMAND
9.0 2721 user bash
1.4 956 root ...
0.5 2212 user ...
EDIT:
You can use adb shell and busybox (http://www.busybox.net/downloads/BusyBox.html)
adb shell busybox top
c:\ adb push busybox /system/bin
c:\ adb shell
# busybox top
CPU: 2.3% usr 3.1% sys 3.9% nic 90.5% idle 0.0% io 0.0% irq 0.0% sirq
Load average: 1.06 1.66 10.63 1/589 8048
←[7m PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND←[0m
31619 2180 10112 S 217m 67.0 0 3.8 com.mgeek.android.DolphinBrowser.B
2232 2180 1000 S 551m169.6 0 2.6 system_server
8038 8037 0 R 2068 0.6 0 0.8 busybox top
2178 1 0 S 11092 3.3 0 0.6 /system/bin/drexe
6812 2180 10104 S 199m 61.2 0 0.5 android.tether
2291 2180 1001 S 324m 99.8 0 0.3 com.android.phone
2308 2180 10006 S 325m100.0 0 0.1 com.sec.android.app.dialertab
2177 1 1001 S 9624 2.8 0 0.1 /system/bin/rild
5 2 0 SW< 0 0.0 0 0.1 [events/0]
30087 2180 10022 S 358m110.4 0 0.0 com.samsung.vvm
2304 2180 10006 S 311m 96.0 0 0.0 com.sec.android.app.twlauncher
16110 2180 10006 S 296m 91.3 0 0.0 android.process.acore
2445 2180 10006 S 272m 83.8 0 0.0 com.sec.android.provider.logsprovi
8064 2180 10002 S 238m 73.4 0 0.0 com.google.process.gapps
31537 2180 10037 S 227m 69.9 0 0.0 com.google.android.gm
2288 2180 10048 S 221m 68.1 0 0.0 com.swype.android.inputmethod
2285 2180 10013 S 215m 66.3 0 0.0 com.tat.livewallpaper.aurora
30664 2180 10011 S 213m 65.8 0 0.0 com.android.email
31191 2180 10099 S 209m 64.4 0 0.0 com.sirma.mobile.bible.android
2377 2180 10087 S 207m 63.9 0 0.0 android.tts
(Taken from here)
Got this information from another thread:
3) Getting CPU info
~$ adb shell dumpsys cpuinfo
Output:
Load: 0.08 / 0.4 / 0.64
CPU usage from 42816ms to 34683ms ago:
system_server: 1% = 1% user + 0% kernel / faults: 16 minor
kdebuglog.sh: 0% = 0% user + 0% kernel / faults: 160 minor
tiwlan_wq: 0% = 0% user + 0% kernel
usb_mass_storag: 0% = 0% user + 0% kernel
pvr_workqueue: 0% = 0% user + 0% kernel
+sleep: 0% = 0% user + 0% kernel
+sleep: 0% = 0% user + 0% kernel
TOTAL: 6% = 1% user + 3% kernel + 0% irq
EDIT:
You can also try this command: echo $(adb shell ps | grep com.android.phone | awk '{ system("adb shell cat /proc/" $2 "/stat");}' | awk '{print $14+$15;}')
Also:
using top : This will show you the cpu stats
top -b -n 1 |grep ^Cpu
using ps: This will show you the % cpu usage for each process.
ps -eo pcpu,pid,user,args | sort -r -k1 | less
EDIT2:
In realtion to your comments and the bounty description (How can I guess which thread eats the battery?) I found an interesting page:
http://ziyang.eecs.umich.edu/projects/powertutor/
As stated there:
You can use PowerTutor to monitor the power consumption of any
application.
Try this for an instance and see if it meets your requirements.
FINAL EDIT:
Check out the Systrace documentation on the developer.android.com site:
http://developer.android.com/tools/debugging/systrace.html
http://developer.android.com/tools/help/systrace.html
I'm sorry if you already tried that, but that's one concrete method to measure the performance.
Use DDMS and method profiling to get a TraceView.
Basically:
Launch your app in debug mode
In DDMS, in the Devices tab, click "Start method profiling"
Do stuff on your device to recreate the conditions you want to monitor
Click "Stop method profiling"
You'll get a fairly detailed graph with each thread's execution that you can drill down into
More details here:
http://developer.android.com/tools/debugging/debugging-tracing.html
Disclaimer: I've only done this with a simple test app so I don't know how much mileage you'll get out of it. It does seem to give a bit more precision than what has been described so far, and does not require root.

How to get all the mount point information for android device?

How do I get all the mount point information for an Android device programmatically?
You can see the partitions known to the system by examining /proc/partitions. From my HTC Desire:
major minor #blocks name
31 0 640 mtdblock0
31 1 4608 mtdblock1
31 2 3072 mtdblock2
31 3 256000 mtdblock3
31 4 40960 mtdblock4
31 5 151168 mtdblock5
179 0 3872256 mmcblk0
179 1 2872070 mmcblk0p1
179 2 1000185 mmcblk0p2
The mtdblock devices are the phone's internal flash storage. mmcblk0 is the phone's SD card.
The best way to see what is mounted where is to examine /proc/self/mountinfo. This is better than /proc/mounts because the latter misses certain information. Again, on my HTC Desire (I added column headings and ran the output through column -s for good measure):
ID PARENT BLOCK ROOT MOUNTPOINT OPTIONS - TYPE SOURCE SUPEROPTS
1 1 0:1 / / ro,relatime - rootfs rootfs ro
11 1 0:11 / /dev rw,relatime - tmpfs tmpfs rw,mode=755
12 11 0:9 / /dev/pts rw,relatime - devpts devpts rw,mode=600
13 1 0:3 / /proc rw,relatime - proc proc rw
14 1 0:12 / /sys rw,relatime - sysfs sysfs rw
15 1 0:13 / /acct rw,relatime - cgroup none rw,cpuacct
16 1 0:14 / /mnt/asec rw,relatime - tmpfs tmpfs rw,mode=755,gid=1000
17 1 0:15 / /mnt/obb rw,relatime - tmpfs tmpfs rw,mode=755,gid=1000
18 11 0:16 / /dev/cpuctl rw,relatime - cgroup none rw,cpu
19 1 31:3 / /system ro,relatime - yaffs2 /dev/block/mtdblock3 ro
20 1 31:5 / /data rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock5 rw
21 1 31:4 / /cache rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock4 rw
22 21 31:5 /local/download /cache/download rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock5 rw
23 1 179:2 / /sd-ext rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
24 20 179:2 /app /data/app rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
25 20 179:2 /data /data/data rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
26 14 0:6 / /sys/kernel/debug rw,relatime - debugfs /sys/kernel/debug rw
27 1 179:1 / /mnt/sdcard rw,nosuid,nodev,noexec,relatime - vfat /dev/block/vold/179:1 rw,dirsync,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
28 1 179:1 /.android_secure /mnt/secure/asec rw,nosuid,nodev,noexec,relatime - vfat /dev/block/vold/179:1 rw,dirsync,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
29 27 0:17 / /mnt/sdcard/.android_secure ro,relatime - tmpfs tmpfs ro,size=0k,mode=000
Not exactly part of the android apis, but the underlying linux will tell you about the ones that are in use if you read /proc/mounts
As a clarification, in later Android versions Linux's ability to have unique mounts for each process ancestry is leveraged, so the mounts seen by an application process can (and typically will) be different than those seen by something launched from ADB, or a core system process.
adb shell df -h
Example
Filesystem Size Used Avail Use% Mounted on
tmpfs 3.6G 1.1M 3.6G 1% /dev
tmpfs 3.6G 0 3.6G 0% /mnt
/proc/mtd
or on other phones:
/proc/emmc
This will show all the partitions and their names - which may or may not currently be mounted.
this worked with my samsung j5
adb shell df -h

How to speed up APK deployments?

In a prototype project a lot of assets & drawables are shipped within the APK.
There is no real option than having a res/ folder 18MB big.
As my phone (HTC Desire) doesn't have enough available memory, I have to use the emulator and notice how extremely slow this is.
Here is the output of the adb logcat command while deploying out of IntelliJ. What I don't understand mainly is why a file system format is being done on every deployment?
D/AndroidRuntime( 1031):
D/AndroidRuntime( 1031): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1031): CheckJNI is ON
D/AndroidRuntime( 1031): --- registering native functions ---
D/dalvikvm( 270): GC_EXPLICIT freed 141 objects / 7400 bytes in 80ms
D/VoldCmdListener( 29): asec list
I/PackageHelper( 270): Size of container 18 MB 17245066 bytes
D/VoldCmdListener( 29): asec create smdl2tmp1 18 fat {} 10027
D/SntpClient( 59): request time failed: java.net.SocketException: Address family not supported by protocol
I//system/bin/newfs_msdos( 29): /system/bin/newfs_msdos: warning, /dev/block/dm-2 is not a character device
I//system/bin/newfs_msdos( 29): /system/bin/newfs_msdos: Skipping mount checks
I//system/bin/newfs_msdos( 29): Bogus heads from kernel - setting sane value
I//system/bin/newfs_msdos( 29): Bogus sectors from kernel - setting sane value
I//system/bin/newfs_msdos( 29): /dev/block/dm-2: 37376 sectors in 4672 FAT32 clusters (4096 bytes/cluster)
I//system/bin/newfs_msdos( 29): bps=512 spc=8 res=32 nft=2 sec=37485 mid=0xf0 spt=63 hds=64 hid=0 bspf=37 rdcl=2 infs=1 bkbs=2
I/logwrapper( 29): /system/bin/newfs_msdos terminated by exit(0)
I/Vold ( 29): Filesystem formatted OK
D/VoldCmdListener( 29): asec path smdl2tmp1
I/PackageHelper( 270): Created secure container smdl2tmp1 at /mnt/asec/smdl2tmp1
I/DefContainer( 270): Created container for smdl2tmp1 at path : /mnt/asec/smdl2tmp1
Now - this takes most time due to file transfer I guess.
Once finished:
I/DefContainer( 270): Copied /data/local/tmp/com.myapp.android to /mnt/asec/smdl2tmp1/pkg.apk
D/VoldCmdListener( 29): asec finalize smdl2tmp1
I/DefContainer( 270): Finalized container smdl2tmp1
I/DefContainer( 270): Unmounting smdl2tmp1 at path /mnt/asec/smdl2tmp1
D/dalvikvm( 270): GC_EXPLICIT freed 166 objects / 13208 bytes in 115ms
D/VoldCmdListener( 29): asec unmount smdl2tmp1 force
D/VoldCmdListener( 29): asec mount smdl2tmp1 {} 1000
D/VoldCmdListener( 29): asec path smdl2tmp1
D/PackageParser( 59): Scanning package: /mnt/asec/smdl2tmp1/pkg.apk
D/dalvikvm( 270): GC_EXPLICIT freed 75 objects / 3664 bytes in 234ms
I either didn't notice on any other APP before, but something seems to be too much here?
Emulator is on Froyo, 2.2.
Any thoughts or ideas on how to speed up this?
Else I guess my laptop is too slow and the whole "asec", encrypted APK things, take too long. Would be nice to speed that up too.
Thanks.
Looks like the secure container stuff is due to the app being installed to SD card by default. Try changing your preferred location to internal storage. This might speed things up a bit.

Categories

Resources