How to launch CTS using command line on Windows? - android

For Android 2.3, I use this command line to enter CTS consoleļ¼š
java -Xmx512M -cp
%CTS_ROOT%\tools\ddmlib-prebuilt.jar;%CTS_ROOT%\tools\cts.jar;%CTS_ROOT%\tools\junit.jar;
%CTS_ROOT%\tools\hosttestlib.jar com.android.cts.TestHost
%CTS_ROOT%\repository/host_config.xml
Is there a similar way of running Android 4.0 CTS like this without cygwin-like thing?

For run Android 4.0+ CTS on Windows
here is my solution:(I assume all path(adb)/classpath(Java) is set correct)
1.download and unzip CTS file(for example,I put all unzipped files into D:\cts , the folder will look like D:\cts\android-cts)
http://source.android.com/compatibility/downloads.html
2.make cts_windows.bat file and put into tools folder.
(that is D:\cts\android-cts\tools\cts_windows.bat in my case)
edit cts_windows.bat file with code below (remember to use your own -DCTS_ROOT path):
java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=D:\cts com.android.cts.tradefed.command.CtsConsole
execute cts_windows.bat file and it will into a shell like "cts-tf>"
then you can run cts using " run cts --plan CTS " command.
for more instructions, read manual at
http://source.android.com/compatibility/android-cts-manual-r4.pdf

For the 4.1 CTS Suite I performed different tasks that resolved my issue.
For windows users running Cygwin:
Modify JAR_PATH setup on line 81, replace the colon with a semi-colon.Also add quotes around the assignment. It should look like the command below:
Bad: JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
Good: JAR_PATH="${JAR_PATH};${JAR_DIR}/${JAR}"
Be sure to run the cts-tradefed script inside the same directory!
Line 73 assumes if CTS_ROOT is not defined then the user is in the same directory as cts-tradefed. But the instructions tell the person to run the script from the directory cts-android is in.
Good: ./cts-tradefed
Bad: ./android-cts/tools/tradefed

Am able to run CTS on Windows, The above Exception is resolved by passing the proper CTS root directory.
By default CTS refers android-cts as root directory, So we should maintain folder as "D:\Android\android-cts"
Pass -DCTS_ROOT=D:\Android
So " Caused by: java.io.FileNotFoundException: CTS install folder D:\cts\android-cts " will be resolved.
java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar
-DCTS_ROOT=D:\Android com.android.cts.tradefed.command.CtsConsole
With above script am able to RUN CTS on my user device.
Thanks.,
Ganesh Kumar Ramamoorthy

I wouldn't recommend to run CTS on Windows.
Until Android 4+, the use of workaround suggested here (use batch file) did worked but when I've tried it, there were many failures and many tests even not executed at all.
Also, according to Google CTS documentation, it should run on Linux or MAC only so how you can guarantee that failures are because of the device under test (real failure), or because you're running it in not supported environment?
Nevertheless, as of Android 6+, the use of batch file in Windows didn't worked for me, CTS will look for bash which exists only in Linux machine and will quit the execution before it starts.
When try to run in on Linux it runs beautifully.

Related

Building framework.jar in AOSP

I am trying to build a framework.jar from android-x86 aosp but 'mm' in /frameworks/base return "No such file or directory". And also I tried "make framework" but after that framework.jar size in out 300 bytes. I tried "make modules" to get framework module name but list so long. May be somebody know what module name for build complete framework.jar ?
Update: I don't know why mm and mmm don't work for me, but I understand thats "make framework" work correctly, after android 5.0 java classes compiling in ART .oat and .odex files. But I try to reverse emulator framework.jar that have framework.jar fro dalvik with .dex files inside. And it confused me when I compared the builded and emulator file.
Firstly, you should have these in your ~/.bashrc when, and do a full build/flash. Otherwise making and building just parts of framework will cause the device to not boot. These will cause the first boot to be a tad slower since the pre-optimizations are not done at build time.
export WITH_DEXPREOPT=false
export DISABLE_DEXPREOPT=true
export DEX_PREOPT_DEFAULT=nostripping
Next build, you can run just
source build/setupenv.sh
lunch XXXXX-userdebug
make framework
And to update on device
adb root
adb remount
adb sync
adb reboot
Try running below command from AOSP main directory:
mmm frameworks/base/
First setup environment by this command :
source build/setupenv.sh
Second lunch your target
lunch your-target
Third use this command to build framework.jar
mmm framework/base
if you have any problem or error , clean the source directory first and then run the third command
make clean

CTS test run taking other version of APK

The device has sdk with AP level 26, and the CTS test is also of level 26. But while running command > run cts-java facing error :
java.lang.RuntimeException: com.android.tradefed.targetprep.TargetSetupError: Failed to install CtsLibcoreTestCases.apk on 00002474. Reason: 'INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1133462583.tmp/base.apk (at Binary XML file line #0): Requires newer sdk version #27 (current version is #26)'
Investigation so far done :
Finding the apk version:
$ aapt dump badging ~/CTS/android-cts/testcases/CtsLibcoreTestCases.apk
package: name='android.libcore.cts' versionCode='26' versionName='8.0.0' platformBuildVersionName='8.0.0'
sdkVersion:'26'
targetSdkVersion:'26'
Finding device sdk version :
$ adb shell getprop ro.build.version.sdk
26
There is no conflict but still there is error arising. My hunch is the device or cts temp directory has stored previous apk data. I dont know how to remove it. Please suggest
have you resolve the issue?
I was experiencing the same and found the following undocumented behaviour, see bellow
Background
As I was testing previously devices based on Android 8.1 (SDK #27) I had corresponding CTS and VTS tests organised under a folder, e.g. TRADFED, then put under the same parent folder CTS for testing Android 8.0 (SDK #26) devices and was getting the same issue with not matching SDK version.
My structure looked something like this:
--TRADFED
|-- android-cts
|-- android-cts-media-1.4
|-- android-cts-verifier
`-- android-vts_81
Investigation
It turned out, that CTS were scanning the entire directory structure from its parent (TRAFED) for the test APKs and VTS contains same Cts*.apk under the testcases subfolder and it was rather trying to install those from VTS rather its own CTS location.
In conclusion
It looks like CTS are pretty selfish and aggressive and scans the entire parent folder for any suitable Cts*.apk apps regardless it sit in completely outside of CTS location.

Android Terminal-IDE: terminal-gcc error: arm-eabi-gcc not found

I'm using Terminal-IDE as my development environment. (Google code site here.)
I'm running Terminal-IDE v 2.02 - the very latest. My Android versions are:
Android 4.0.3
Software version 2.14.531.3 71ORD
(the rest aren't likely pertinent, but more on request)
I'm in a suitable development directory with a simple enough c source code file ready and run 'make'.
I have never yet gotten any compilation to work successfully. Most likely, there's a version mis-match with regard to what executable is available versus what the software is looking for.
Here's the command and error message:
terminal-gcc -c -Wall -I/data/data/com.spartacusrex.spartacuside/files/local/include tester.c -o tester.o
/data/data/com.spartacusrex.spartacuside/files/system/bin/terminal-gcc[43]: arm-eabi-gcc: not found
make: *** [tester.o] Error 127
Snafu, of course. I'm not at all sure how to find out what the right compiler file name(s) should be because, on this non-rooted phone, I don't have permissions to hunt through the PATH and find the actual executables.
It may also be that PATH is set wrong. All input appreciated.
...I'm not sure what's supposed to happen, but I found in the Terminal-IDE directory tree the file:
$IDESYSTEM/android-gcc-4.4.0.tar.gz
I also found that terminal-gcc is a bash script. Looking inside it seemed to say that a gcc tree should exist in "$HOME", which is the installation directory. So, I unzipped, then un-tarred the file identified above and put the resulting directory tree as a top-level subdirectory.
Well well, what do you know? Success.
I went a little further and created soft links to the actual compiler in ~/bin for both gcc and just cc, and suddenly all my previously created "Makefile" scripts used in other projects I wanted to move over started working perfectly.
Apparently, even though I thought I'd done it right, I overlooked running this script:
./system/bin/install_gcc
It extracts the tar, like I did, but does not create the links you may need.
Hey, if you're glad I got here before you, give it a thumbs up!
A credit goes to #Richard T for his enthusiasm regarding Terminal IDE. The answer is intended to enumerate the steps needed for running a C code.
To run a C code
Run Terminal IDE and extract the gcc package by executing
install_gcc
Create a directory for your projects within the Terminal IDE directory tree. Then in the directory create a source .c file with some code (filename.c here). Compile it
terminal-gcc -c filename.c
Create the executable file
terminal-gcc filename.o -o filename.out
Run the output file
./filename.out
If you'd like to use the PC (laptop) keyboard you can telnet Terminal IDE.
To Telnet Terminal IDE
From Terminal IDE start the telnetd deamon by executing
telnetd
Connect the Android device to the PC (laptop) and type
adb forward tcp:[port] tcp:8080
telnet 127.0.0.1 [port]
P.S. Telnet's default port is 23.

how to edit run.sh file in eclipse

I need to edit run.sh file in eclipse in windows. I'm following instructions in here, and I've installed the Android app completely and it's OK on my Xperia, however when it comes to building the host client part in the fourth line I don't know what run.sh does neither I know how to edit it,by the way, I guess it's a Linux file. And I have to say that I haven't installed CyanogenMod software as it is not Xperia p compatible according to it's website. The code in run.sh file in se.pki.client package, which I downloaded and imported previously, is as following.Althoug I've changed the code in the second line(giving it the path where my jdk is stored) while there's still an error in the first line saying the word "sh" is not correctly spelled and another error in the third line to
#!/bin/sh
JAVA_HOME=C:\ProgramFiles\java\jdk1.7.0\
$JAVA_HOME/bin/java -Dsun.security.smartcardio.library=/usr/local/lib/libpcsclite.so -cp bin/ org.nick.sepkiclient.Main $*
.sh files are the linux equivalent to a batch file. From the code you posted it just runs the java command (giving it a bunch of command line inputs) you should be able to run the same command in the windows terminal by just replacing the paths to windows paths. If there is more to the script than the 3 lines, you're going to needed to try and convert each line to a valid windows command (depending on the complexity of the script, this may not be possible.)
Your other option is to install software like Cygwin which adds a POSIX compliment shell (along with many other linux-ish modifications). This should allow you to run .sh files 'natively' in windows (it will require some fiddling with the script to provide the correct paths). Be sure you read about cigwin before you install it, it changes quite a lot about your system that you might not be comfortable with.
Each option has its drawbacks, and both require a little knowledge of shell scripting. Might just be easier to run Linux for what your doing (it behaves itself reasonably well in a VM).
Make sure you have it set as a unix file.
Window> Preferences>General>Workspace
Select line delimiter Other then Unix and test file encoding as UTF-8
As a last resort run dos2unix on the file from the shell.

unable to run node.js on Android phone?

I have been trying to port Node.js on Android phone
by following the link below
http://www.xydo.com/toolbar/20311835-node_js_on_android
I created the node.tar on QEMU environment and sent it to the ubuntu machine ?
I have put all .so files in system/lib and node bin file in system/bin .
When i try to run it it gives "Node not Found " even though it is present .
NOTE : I have manually pushed the files since tar command does not work on android .
I am using a rooted device .
Is there any way to create the binary file in android directly without the ARM environment ???
Am i missing something ?Thanks for the help .
Thanks for the response .
I have installed debian on Android using your suggested link:
http://lanrat.com/android/debian
After that, when I run the following commands on chroot to be able to make and install Node js, (ref:http://howtonode.org/f1932c1c56d3a50fe0c21998362d80f405229b5a/arm-chroot-fun)
$git clone http://github.com/creationix/nvm.git
$. nvm/nvm.sh
$export JOBS=1
$nvm install v0.4.11
I get the following error:
/.nvm/src/node-v0.4.11/deps/v8/src/arm/macro-assembler-arm.cc:61:3: error: #error "For thumb inter-working we require an architecture which supports blx"
scons: *** [obj/release/arm/macro-assembler-arm.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/.nvm/src/node-v0.4.11/build'
Build failed: -> task failed (err #2):
{task: libv8.a SConstruct -> libv8.a}
Alternately, if I try the following:
$ mkdir tmp
$ cd tmp
$ wget http://nodejs.org/dist/node-v0.4.11.tar.gz
$ tar -xvzf node-v0.4.11.tar.gz
Added '-march=armv5t' to 'CCFLAGS',in node-v0.4.11/deps/v8/SConstruct and the
$ cd node-v0.4.11
$ ./configure
$ make
$ make install
the installation runs without errors, node --version reports v0.4.11 and when I try to run any node commands, I get pure virtual method called terminate called without an active exception Aborted
can you please let me know what i am doing wrong here?
You definitely have tar on your phone and everything else that comes with busybox! http://en.wikipedia.org/wiki/BusyBox Also look at this it will improve your Droid hacking time 10 fold https://github.com/jackpal/Android-Terminal-Emulator/wiki/Frequently-Asked-Questionsand consider acquiring http://www.magicandroidapps.com/wiki//index.php?title=Main_Page and https://market.android.com/details?id=org.pocketworkstation.pckeyboard Your going to wonder how you where doing it before you got these. The tutorial you where following was a little shaky so I included the resources I used to get ubuntu and nodejs running on my Android. It took me a while but it was a lot easier after a little research on how exactly debootstrap and qemu worked, you have to get a little linuxy but once its running you will be amazed at all the options you have. http://lanrat.com/android/debian http://howtonode.org/f1932c1c56d3a50fe0c21998362d80f405229b5a/arm-chroot-fun What I ended up doing was building a cross compilation tool kit using deb boot strap and qemu and compiling everything on my desktop then moving the image over to my Android. Lastly I included my arm ubuntu Image. You may have to tweak the bash script a bit but other then that the image is universal and even runs on an IPhone. If you have any trouble digesting all this or getting the image working feel free to ask. I want to see node on as many phones as possible! www.castedspell.com/ubuntu4droid.tar.gz The image is 3 gigs uncompressed but really only 600 mb and you can use any partition re-size tool to shrink it down.
There is an Android port of NodeJS with source you can get up and running with.

Categories

Resources