I am attempting to use tracedmdump to parse trace files off the Android emulator. I have gone backwards and forwards with the Android OS repo, building the kernel, etc, and I can only assume I missed a step since when I run tracedmdump I get the output:
-bash: post_trace: command not found
***
*** Error: malformed trace. Did you remember to exit the emulator?
***
I'm getting my trace files through:
$ android create avd -n <emu name> -t <target id> -p <my dir> -s <skin> -b armabi-v7a -c 256M -f
$ emulator -trace <folder name> -avd <avd name> -memory 2048 -gpu on -debug-init
then once the emulator is going I use F9 to start then stop tracing.
I've looked, and there's no sign of post_trace anywhere on my machine. I have found 0 resources for why this might be, so I'm lead to believe that something quietly failed in my build process, but I have no idea what it could possibly be. I'm on Mac OSX, and attempting to use the manta kernel, but I don't know what other information could be useful. Please help!
Try cd into /sdk/emulator/qtools folder, and type mm command option to compile those tools.
Related
When I compiling the AOSPA ROM, it always stopped with following massage:
make: *** No rule to make target 'out/target/product/nx529j/obj/SHARED_LIBRARIES/libqdutils_intermediates/export_includes', needed by 'out/target/product/nx529j/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/import_includes'. Stop.
I have tried to find solution on Google, github and XDA-Developers forum, but I can't found any solutions .
Wha shoi I do?
Solution is Simple but no perfect:
$ pushd out/target/product/nx529j/obj/SHARED_LIBRARIES/
$ mkdir libqdutils_intermediates
$ touch libqdutils_intermediates/export_includes
$ popd
Do not clear cache or delete the out/ folder, just try to build (bruch/make/launch) again .
The reason for this error is missing libqdutils.so , the one you can pull from device. The solution above just for showing up the missing libqdutils.so error for you in next build you try.
Once you encounter missing libqdutils.so error, just (be sure android device connected to pc for adb):
$ pushd ./vendor/{manufacturer}/{device}/proprietary/
$ adb pull /system/lib/libqdutils.so ./
$ popd
Reference:
https://forum.xda-developers.com/showthread.php?t=2357126
https://forum.xda-developers.com/showthread.php?t=2754997&page=147
I'm trying to build an empty new project project for Android target from Qt Creator, but I'm getting this error:
12:51:05: Packaging error: Command "C:/adt/sdk/platform-tools/adb.exe -s emulator-5554 pull /system/bin/app_process C:/Workspace/NewProjects/build-untitled18-Android_for_x86_GCC_4_9_Qt_5_4_2-Debug/app_process" failed.Exit code: 1
Screenshot:
And the full log, in case needed.
How do I fix that error?
After reading the answer to a related question:
As mentioned before, Android 5.0 has /system/bin/app_process as a symlink to /system/bin/app_process32. Since a symlink cannot be pulled with adb pull, the ndk-gdb script will not be able to work as-is.
I just logged into the android emulator VM and replaced the symlink with a copy of the file:
C:\Users\sasho>adb shell
root#generic_x86:/ # mount -o rw,remount /system
root#generic_x86:/ # cd /system/bin
root#generic_x86:/system/bin # rm app_process
root#generic_x86:/system/bin # cp app_process32 app_process
And it worked after that!
I would like to run monkey on Jenkins but after use configuration:
https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=57181910
I see in monkey.txt file:
No activities found to run, monkey aborted.
$ E:\server\AndroidSDK/platform-tools/adb.exe -s localhost:46881
shell monkey -v -v -p package.name -s 0 --throttle 0 50
$E:\server\AndroidSDK/platform-tools/adb.exe disconnect
localhost:46881 [android] Stopping Android emulator [android]
Archiving emulator log
I run this command on my PC, but I cannot run it on server.
If I run the command: adb shell monkey -v -v 50 -p package.name -s --throttle 0 on cmd on server it will work.
How can I configure Jenkins to run monkey properly?
I'm using the newest plugins for Jenkins.
Are you really using "package.name" in the monkey command line rather than your actual package name?
Did you ensure the APK was installed on the emulator before running monkey?
Otherwise, is there any output in the logcat.txt which indicates what's going wrong?
Also, I'm not sure why you linked to a really old version of the Android Emulator Plugin wiki page, but since then there's a Jenkins build step that will run monkey for you, without you having to manually write it into a batch script step.
Like Thomas pointed out in Christopher's comment:
You also have to think about installing the apk to the smartphone.
This can be done by using the "install android package" build step before "Run android monkey tester".
After that you can add another build step "uninstall android package"
I am able to pull down the latest android source code into a Ubuntu virtual machine 32-bit (Host: Windows 7 64-bit). The build completes without any errors.
Then I tried to follow these instructions, where it mentions that I should run the emulator on the root of my source code. However, when I tried that, I get an error stating that this command is not found.
So I went to the folder out/host/linux-x86/bin and I found out that there are couple files for emulator*:
emulator
emulator-arm
emulator_renderer
emulator-ui
emulator-x86
When I typed the emulator and emulator-x86 here, it also doesn't work. Here is the error I'm getting:
xxxx/out/host/linux-x86/bin$ ./emulator-x86
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '#<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
So when I run ./emulator-x86 -help-disk-images, I see the following:
If you are building from the Android build system, you should
have ANDROID_PRODUCT_OUT defined in your environment, and the
emulator shall be able to pick-up the right image files automatically.
See -help-build-images for more details.
I built this myself, so I would think that ANDROID_PRODUCT_OUT is set in my environment variables, but I don't see it. So I think that I should run some other shell script to get that set.
I looked at the img files, I saw couple at the location out/target/product/generic:
ramdisk.img
system.img
userdata.img
Could anyone shed some light on this and assist me on what I should do next? I am new to Android and I did some research on this but I couldn't find any similar issues.
I do not know for which product you do your build but to run emulator you can use the following command:
out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-size 1024
Just copy it into .sh file into the root of your Android source folder and run this file. Or you can just run it but you should chdir to your Android source folder root at first.
And do not forget to create an sdcard image in the root folder with command mksdcard.
After much puzzling and encountering many of the same problems, I've found a way to get everything working from a new environment.
Environment
First of all, make sure you set your environment with the changes to ~/.bashrc that Android recommends, including:
export USE_CCACHE=1
ccache -M 10G
Follow the steps for downloading the Android source, if you haven't already done so.
Then set up some functions for the environment:
$ . build/envsetup.sh
You now should actually execute one of those functions to get the paths set correctly (as Pingzhong Li pointed out, this is not mentioned in the Android build instructions!):
$ set_stuff_for_environment
First build
Start building! For instance:
$ lunch full-eng
$ make -j4
(Here, 4 threads is ideal for my machine. Change as you see fit.)
When the build finishes, simply launch the emulator:
$ emulator
Subsequent builds
I've found that to get the system.img to rebuild, you need to remove the following files/directories:
out/target/product/generic/obj/PACKAGING/
out/target/product/generic/system.img
Then simply repeat:
$ make -j4
$ emulator
How to run Emulator step by step guide.
Running emulator in downloaded android AOSP source code is as below :-
Step 1
If you have finished your build and generated System image correctly in current running Terminal(Ubuntu), Then it is stragiht forward. Just type below command in your terminal:-
emulator
Step 2
If you have generated system image earlier and you have started a fresh terminal(Ubuntu) then run the following command one by one :-
source build/envsetup.sh
lunch 1 here 1 is my lunch type, you can replace it with yours like(7, 8 etc) and in the last
emulator
Thats it it will lunch your emulator correctly.
Thanks Guys Happy Coding !!!!
Just for reference I had this similar problem and after trying different things I found the solution to be running lunch(after running envsetup.sh) and picking the target in this case aosp_arm-eng. You have to do this everytime you start a new shell because it sets up certain environment variables the emulator needs to run the avd.Provided you have built the target.
#!/usr/bin/env bash
ANDROID_BUILD_OUT=/path/to/android/build/output/
ANDROID_SDK_LINUX=/path/to/android/sdk
ANDROID_BUILD=${ANDROID_BUILD_OUT}/android/target/product/generic
${ANDROID_SDK_LINUX}/tools/emulator \
-sysdir ${ANDROID_BUILD} \
-system ${ANDROID_BUILD}/system.img \
-ramdisk ${ANDROID_BUILD}/ramdisk.img \
-data ${ANDROID_BUILD}/userdata.img \
-kernel ${ANDROID_SDK_LINUX}/system-images/android-18/armeabi-v7a/kernel-qemu \
-skindir ${ANDROID_SDK_LINUX}/platforms/android-18/skins \
-skin WVGA800 \
-scale 0.7 \
-memory 512 \
-partition-size 1024
On a mac, you can add the following lines into your ~/.bash_profile file. Change your disk image and src folders accordingly.
# start emulator
function startEmulator { hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android;
cd /Volumes/android/AndroidSrc;
source build/envsetup.sh;
lunch aosp_arm-eng;
/Volumes/android/AndroidSrc/out/host/darwin-x86/bin/emulator; }
After that, create a new terminal and type:
startEmulator
Your emulator can be started. This works on mac.
Just type emulator on your shell and it will launch the emulator of the latest build as its path is set to the PATH variable of your shell.
If you have the "android sdk" on your machine, then your "emulator" could be picked up from there instead of /out/.... dir.
When you want to work with your "own" emulator, you can rename the "android sdk" directory. Then your "emulator" will be picked up.
Hope this helps you!
Regards
Sammoh
export MY_PWD=/work/ABC/Google_Android
export ANDROID_BUILD_TOP=/work/ABC/Google_Android
export PATH=$PATH:$MY_PWD/prebuilts/gcc/linux
export ANDROID_PRODUCT_OUT=$MY_PWD/out/target/product/generic
The above is my env setting.
ANDROID_BUILD_TOP solved the
"emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found"
on my machine
I performed this way
I modified the ./build/envsetup.sh file, I only changed the set_stuff_for_environment
function set_stuff_for_environment()
{
setpaths
set_sequence_number
export ANDROID_BUILD_TOP=$(gettop)
# With this environment variable new GCC can apply colors to warnings/errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export ASAN_OPTIONS=detect_leaks=0
export ANDROID_PRODUCT_OUT=/var/www/android/out/target/product/generic_x86_64
echo $ANDROID_PRODUCT_OUT
}
At the root of the project I created a file named start.sh
#!/usr/bin/env bash
ANDROID_BUILD_OUT=/var/www/android/out
ANDROID_SDK_LINUX=/opt/android-studio/sdk
ANDROID_BUILD=${ANDROID_BUILD_OUT}/target/product/generic_x86_64
sudo chmod -R 777 /dev/kvm
source build/envsetup.sh
set_stuff_for_environment
./prebuilts/android-emulator/linux-x86_64/emulator \
-debug-init -logcat '*:v' -verbose \
-sysdir ${ANDROID_BUILD} \
-system ${ANDROID_BUILD}/system.img \
-ramdisk ${ANDROID_BUILD}/ramdisk.img \
-skindir ${ANDROID_SDK_LINUX}/platforms/android-28/skins \
-skin WVGA800 \
-partition-size 2000
-scale 0.7 \
-memory 2000 \
-data ${ANDROID_BUILD}/userdata.img \
My same BASH script is working in Fedora/CentOS.
But I am testing one Android eee pad transformer.
Where i have terminal access and i wrote a small test script. But its not working, how can i fix it? what am i doing wrong?
/data/data/berserker.android.apps.sshdroid/home $ cat test.sh
#!/bin/bash
var=`ifconfig -a`;
echo $var;
/data/data/berserker.android.apps.sshdroid/home $ chmod +x test.sh
/data/data/berserker.android.apps.sshdroid/home $ ./test.sh
sh: ./test.sh: not found
/data/data/berserker.android.apps.sshdroid/home $ uname -a
Linux localhost 2.6.36.3-00004-g069b8b5 #1 SMP PREEMPT Wed May 11 22:14:22 CST 2011 armv7l GNU/Linux
/data/data/berserker.android.apps.sshdroid/home $ bash ./test.sh
sh: bash: Permission denied
/data/data/berserker.android.apps.sshdroid/home $ ls -l /bin/bash
ls: /bin/bash: No such file or directory
/data/data/berserker.android.apps.sshdroid/home $ find / -name "bash"
find: /config: Permission denied
lots more.......
find: /proc/595/task/598/fd: Permission denied
......
find: /data: Permission denied
find: /root: Permission denied
Follow up:
This is my script now which works:
#!/bin/sh
echo "hello wassup, run me simply as './test.sh'";
or
#!/bin/bash
echo "hello wassup, run me using 'sh ./test.sh'";
in Android the shell is located in /system/bin/sh not /bin/sh like it is on most Unix-like systems. So even if you change #!/bin/bash to #!/bin/sh it will still not work. you'll have to use #!/system/bin/sh
Android is not a GNU/Linux distribution so you can't expect that all scripts that run on GNU/Linux to also work on Android.
May be it will work when calling interpreter with a script?
$ bash ./test.sh
I saw, that although it is specified #!/bin/bash error was posted by sh - may be it do wrong.
UPD
$ sh ./test.sh
Most Android devices don't have a bash interpreter installed. If you really need to run the script across Linux and Android, you could try using BusyBox but that will require rooting your device (and potentially voiding your warranty). Even then though, I don't know if the ifconfig utility is included in BusyBox.
I would strongly recommend using the Android SDK to write an app to do whatever your trying to accomplish.
As was stated, the Android OS (up to and including 4.0) does not include the BASH interpreter (just shell). While BusyBox is a great tool, I believe it's only a single executable that combines stripped-down-functionality-for-size versions of common UNIX utilities, but doesn't actually include the BASH interpreter.
For an Android compiled version of the BASH interpreter, refer to this Forum thread:
http://forum.xda-developers.com/showthread.php?t=537827
You can install Busybox, which provides you with many utilities such as awk, file, etc... and Terminal Emulator.
Create a shell file with #!/system/bin/sh as the first line (shebang)
Now place the completed script under /system/xbin or /system/bin and run it from the Terminal Emulator
The information is an excerpt from this article : HOW TO RUN SHELL SCRIPTS ON ANDROID DEVICES