SystemTap on Android - android

when I executed the command ' staprun ' on the android , I met following problem :
# /data/systemtap-1.0-omap/bin/staprun /data/local/msyscall_all.ko
/data/systemtap-1.0-omap/bin/staprun: 1: Syntax error: "(" unexpected
#
the module msyscall_all.ko is cross-compiled with the kernel that my android run on.
firstly, I am sure that msyscall_all.ko is exactlly right , because I use command ' insomd ' and ' lsmod ' to ensure it is right .I did it as following :
# lsmod
omaplfb 8986 0 - Live 0xbf032000
pvrsrvkm 137346 29 omaplfb, Live 0xbf000000
# insmod /data/local/msyscall_all.ko
# lsmod
msyscall_all 1121778 0 - Live 0xbf037000
omaplfb 8986 0 - Live 0xbf032000
pvrsrvkm 137346 29 omaplfb, Live 0xbf000000
#
secondly, I followed the instruction in :http://omappedia.org/wiki/Systemtap#Systemtap_1.0_code_update_for_OMAP_ARM_platforms
And my systemtap-1.0-omap was cross-compiled successfully!! Howerver, after I used 'adb push' to pushed the systemtap-1.0-omap to my android device and ran it ,I got the error below :
/data/systemtap-1.0-omap/bin/staprun: 1: Syntax error: "(" unexpected
when the 'staprun' was ran on the ubuntu ,it gave me advice how run ' staprun ' , and when it was run on the android device ,it went wrong :
# /data/systemtap-1.0-omap/bin/staprun
/data/systemtap-1.0-omap/bin/staprun: 1: Syntax error: "(" unexpected
# exit
ubuntu#ubuntu:~$ cd systemtap-1.0-omap/bin/
ubuntu#ubuntu:~/systemtap-1.0-omap/bin$ ./staprun
ERROR: Need a module name or path to load.
./staprun [-v] [-c cmd ] [-x pid] [-u user] [-A|-L|-d]
[-b bufsize] [-o FILE [-D] [-S size[,N]]] MODULE [module-options]
-v Increase verbosity.
-c cmd Command 'cmd' will be run and staprun will
exit when it does. The '_stp_target' variable
will contain the pid for the command.
-x pid Sets the '_stp_target' variable to pid.
-o FILE Send output to FILE. This supports strftime(3)
formats for FILE.
-b buffer size The systemtap module specifies a buffer size.
Setting one here will override that value. The
value should be an integer between 1 and 4095
which be assumed to be the buffer size in MB.
That value will be per-cpu in bulk mode.
-L Load module and start probes, then detach.
-A Attach to loaded systemtap module.
-d Delete a module. Only detached or unused modules
the user has permission to access will be deleted. Use "*"
(quoted) to delete all unused modules.
-D Run in background. This requires '-o' option.
-S size[,N] Switches output file to next file when the size
of file reaches the specified size. The value
should be an integer greater than 1 which is
assumed to be the maximum file size in MB.
When the number of output files reaches N, it
switches to the first output file. You can omit
the second argument.
MODULE can be either a module name or a module path. If a
module name is used, it is looked for in the following
directory: /lib/modules/`uname -r`/systemtap
ubuntu#ubuntu:~/systemtap-1.0-omap/bin$
I have tried my best , but I can not solve it !!

Related

How can we copy all the apps from android(adb) to PC using Batch scripting?

myapps.txt - contains the list of all packages found through adb shell pm list packages > myapps.txt
package:com.flipkart.android
package:com.android.certinstaller
package:com.android.carrierconfig
package:com.reddit.frontpage
package:com.wapi.wapicertmanage
package:com.brave.browser
Following is the code I wrote in the batch script to copy all the apps in one go from android to PC using ADB.
Secondly, I'm splitting my string by colon(:) such that for example -
string1 contains package and
string2 contains com.google.android.youtube
#echo off
setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%i in (myapps.txt) do (
echo j: %%j
set string2=%%j
adb shell pm path !string2! > tmp.txt
set /p new=< tmp.txt
#echo on
#echo new: !new!
#echo off
set "str=%new%"
set "string1=%str::=" & set "string3=%"
del tmp.txt REM delete file after reading from it.
REM creating new folder for each app
mkdir apps_%input%\%string2%
REM pulling app from Android to PC
adb pull %string3% apps_%input%\%string2%
set /a count+=1
echo Done !count!
)
Here's the following output after 2 executions of for loop I'm getting
j: com.flipkart.android
new: package:/data/app/com.flipkart.android-XOmoiAws7zOd07eM1nZIlg==/base.apk
A subdirectory or file apps_2\ already exists.
adb: error: failed to stat remote object 'apps_2\': No such file or directory
Done 1
j: com.android.certinstaller
new: package:/system/app/CertInstaller/CertInstaller.apk
A subdirectory or file apps_2\ already exists.
adb: error: failed to stat remote object 'apps_2\': No such file or directory
Done 2
Please help me why I'm getting this output. Also apps_2 don't exist before execution how it's prompting that it already exists.
But,the same thing is working perfectly in cmd prompt:
mkdir apps_2\com.flipkart.android
adb pull /data/app/com.flipkart.android-XOmoiAws7zOd07eM1nZIlg==/base.apk apps_2\com.flipkart.android
here's the output I received after execution
/data/app/com.flipkart.android-XOmoiAws7zOd07eM1nZIlg==/base.apk: 1 file pulled. 33.8 MB/s (12691794 bytes in 0.358s)
The batch file is not working as expected because of delayed expansion is used only for some, but not all environment variable references inside the FOR command block. Only the environment variable input can be referenced with %input% inside the command block as it is the only environment variable defined outside the command block and not modified inside the command block. All other environment variables are defined/modified inside the command block and referenced inside the command block. For that reason all environment variables except input must be referenced with using ! instead of %.
However, the usage of environment variables is not needed at all for this task.
#echo off
setlocal EnableExtensions DisableDelayedExpansion
if not defined input set "input=1"
set "count=0"
if exist myapps.txt for /F "tokens=2 delims=:" %%I in (myapps.txt) do (
echo Getting path of app "%%I" ...
for /F "tokens=2 delims=:" %%J in ('adb.exe shell pm path "%%I" 2^>nul') do (
echo Path of app %%I is: "%%J"
rem Creating new folder for each app.
mkdir "apps_%input%\%%I" 2>nul
if exist "apps_%input%\%%I\" (
rem Pulling app from Android to PC.
echo Pulling app "%%I" to "apps_%input%\%%I" ...
adb.exe pull "%%J" "apps_%input%\%%I"
set /A count+=1
) else echo ERROR: Failed to create directory: "apps_%input%\%%I\"
)
)
if %count% == 1 (set "PluralS=") else set "PluralS=s"
echo Pulled %count% app%PluralS% from Android to PC.
endlocal
The outer FOR reads one line after the other from myapps.txt. Each line is split up into substrings using the colon as delimiter because of option delims=:. The first colon delimited substring is always package which is of no interest for this task. Therefore the option tokens=2 is used to assign the second substring like com.flipkart.android to the specified and case-sensitive loop variable I.
The inner FOR loop starts in background one more command process with %ComSpec% /c and the command line in the parentheses appended as additional argument. The output of adb to handle STDOUT of the background command process is captured by FOR and processed line by line after started cmd.exe closed itself after adb terminated itself.
The single line output by adb is again split up into substrings using colon as delimiter with assigning again just the second substring to specified loop variable J.
Next a subdirectory is created with application name as directory name with redirecting the error message output on directory already existing or failed to create from handle STDERR to device NUL to suppress it.
Then an existence check for the just created directory is made to verify if it really exists and if this is the case the application is pulled from Android device to PC.
The help output on running cmd /? in a command prompt window explains on last page that a file name (or any other argument string) containing a space or of these characters &()[]{}^=;!'+,`~ must be enclosed in double quotes. For that reason all argument strings referencing the value assigned currently to the loop variables I (app name) and J (app path) are enclosed in ".
All echo command lines and the last if condition can be removed as they are just for getting some progress information during execution of the batch file.
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
echo /?
endlocal /?
for /?
if /?
mkdir /?
rem /?
set /?
setlocal /?
Read the Microsoft article about Using command redirection operators for an explanation of 2>nul. The redirection operator > must be escaped with caret character ^ on FOR command line to be interpreted as literal character when Windows command interpreter processes this command line before executing command FOR which executes the embedded adb command line with using a separate command process started in background.

Script that will transfer photos from phone camera using adb

Story
I take photos and record videos with my phone camera and keep all of them on my internal storage/sdcard. I periodically back them up on my PC, so I keep these camera photos on PC storage in sync with phone storage.
For years, I've been backing up my phone camera photos to my PC in the following way:
Plug in phone into PC and allow access to phone data
Browse phone storage → DCIM → Camera
Wait several minutes for the system to load a list of ALL photos
Copy only several latest photos which haven't been backed up yet
I figured that waiting several minutes for all photos to load is an unnecessary drag so I downloaded adb platform tools. I've added the folder bin to my Path environment variable (i.e. %USERPROFILE%\Tools\adb-platform-tools_r28.0.3) so that I can seamlessly use adb and not write its full path each time.
The script
I wrote the following script for Git Bash for Windows. It is also compatible with Unix if you change the $userprofile variable. Essentially, the script pulls camera photos between two dates from phone storage to PC.
# Attach device and start deamon process
adb devices
# Initialize needed variables
userprofile=$(echo "$USERPROFILE" | tr "\\" "/") # Windows adjustments
srcFolder="//storage/06CB-C9CE/DCIM/Camera" # Remote folder
dstFolder="$userprofile/Desktop/CameraPhotos" # Local folder
lsFile="$dstFolder/camera-ls.txt"
filenameRegex="2019061[5-9]_.*" # Date from 20190615 to 20190619
# Create dst folder if it doesn't exist
mkdir -p "$dstFolder"
# 1. List contents from src folder
# 2. Filter out file names matching regex
# 3. Write these file names line by line into a ls file
adb shell ls "$srcFolder" | grep -E "$filenameRegex" > "$lsFile"
# Pull files listed in ls file from src to dst folder
while read filename; do
if [ -z "$filename" ]; then continue; fi
adb pull "$srcFolder/$filename" "$dstFolder" # adb: error: ...
done < "$lsFile"
# Clean up
rm "$lsFile"
# Inform the user
echo "Done pulling files to $dstFolder"
The problem
When I run the script (bash adb-pull-camera-photos.sh), everything runs smoothly except for the adb pull command in the while-loop. It gives the following error:
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190618_124656.jpg
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190618_204522.jpg
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190619_225739.jpg
I am not sure why the output is broken. Sometimes when I resize the Git Bash window some of the text goes haywire. This is the actual error text:
adb: error: failed to stat remote object '//storage/06CB-C9CE/DCIM/Camera/20190618_124656.jpg': No such file or directory
adb: error: failed to stat remote object '//storage/06CB-C9CE/DCIM/Camera/20190618_204522.jpg': No such file or directory
adb: error: failed to stat remote object '//storage/06CB-C9CE/DCIM/Camera/20190619_225739.jpg': No such file or directory
I am sure that these files exist in the specified directory on the phone. When I manually execute the failing command in bash, it succeeds with the following output:
$ adb pull "//storage/06CB-C9CE/DCIM/Camera/20190618_124656.jpg" "C:/Users/User/Desktop/CameraPhotos/"
//storage/06CB-C9CE/DCIM/Camera/20190618_124656.jpg: 1 file pulled. 15.4 MB/s (1854453 bytes in 0.115s)
The question
I can't figure out what's wrong with the script. I thought the Windows system might be causing a commotion, because I don't see the reason why the same code works when entered manually, but doesn't work when run in a script. How do I fix this error?
Additional info
Note that I had to use // in the beginning of an absolute path on Windows because Git Bash would interpret / as its own root directory (C:\Program Files\Git).
I've echoed all variables inside the script and got all the correct paths that otherwise work via manual method.
camera-ls.txt file contents
20190618_124656.jpg
20190618_204522.jpg
20190619_225739.jpg
Additional questions
Is it possible to navigate to external sdcard without using its name? I had to use /storage/06CB-C9CE/ because /sdcard/ navigates to internal storage.
Why does tr "\\" "/" give me this error: tr: warning: an unescaped backslash at end of string is not portable?
Windows batch script
Here's a .bat script that can be run by Windows Command Prompt or Windows PowerShell. No Git Bash required.
:: Start deamon of the device attached
adb devices
:: Pull camera files starting from date
set srcFolder=/storage/06CB-C9CE/DCIM/Camera
set dstFolder=%USERPROFILE%\Desktop\CameraPhotos
set lsFile=%USERPROFILE%\Desktop\CameraPhotos\camera-ls.txt
set dateRegex=2019061[5-9]_.*
mkdir %dstFolder%
adb shell ls %srcFolder% | adb shell grep %dateRegex% > %lsFile%
for /F "tokens=*" %%A in (%lsFile%) do adb pull %srcFolder%/%%A %dstFolder%
del %lsFile%
echo Done pulling files to %dstFolder%
Just edit the srcFolder to point to your phone camera folder,
plug a pattern into the dateRegex for matching the date interval and
save it as a file with .bat extension, i.e: adb-pull-camera-photos.bat.
Double-click the file and it will pull filtered photos into CameraPhotos folder on Desktop.
Keep in mind that you still need have adb for Windows on your PC.
The problem was with Windows line delimiters.
Easy fix
Just add the IFS=$'\r\n' above the loop so that the read command knows the actual line delimiter.
IFS=$'\r\n'
while read filename; do
if [ -z "$filename" ]; then continue; fi
adb pull "$srcFolder/$filename" "$dstFolder"
done < "$lsFile"
Explanation
I tried plugging the whole while-loop into the console and it failed with the same error:
$ bash adb-pull-camera-photos.sh
List of devices attached
9889db343047534336 device
tr: warning: an unescaped backslash at end of string is not portable
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190618_124656.jpg
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190618_204522.jpg
': No such file or directoryemote object '//storage/06CB-C9CE/DCIM/Camera/20190619_225739.jpg
Done pulling files to C:/Users/User/Desktop/CameraPhotos
This time I started investigating why the output was broken. I remembered that windows uses \r\n as newline, which means Carriage Return + Line Feed, (CR+LF), so some text must have been overwritten.
It was because of broken values stored inside the $filename variable.
This is the loop from the script:
while read filename; do
if [ -z "$filename" ]; then continue; fi
adb pull "$srcFolder/$filename" "$dstFolder"
done < "$lsFile"
Since each iteration of the while-loop reads a line from $lsFile in the following form:
exampleFilename.jpg\r\n
It misinterprets the newline symbols as part of the file name, so adb pull tries to read files with these whitespaces in their names, but fails and it additionally writes a broken output.
Adb Photo Sync
This might not be the answer but might be useful for others looking for android photo/files backup solution.
I use this script on my Windows with git bash. This can be easily used for Linux. A common issue with a long backup process is that it might get interrupted and you might have to restart the entire copy process from start.
This script saves you from this trouble. You can restart the script or interrupt in between but it will resume copy operation from the point it left.
Just change the rfolder => android folder, lfolder => local folder
#!/bin/sh
rfolder=sdcard/DCIM/Camera
lfolder=/f/mylocal/s8-backup/Camera
adb shell ls "$rfolder" > android.files
ls -1 "$lfolder" > local.files
rm -f update.files
touch update.files
while IFS= read -r q; do
# Remove non-printable characters (are not visible on console)
l=$(echo ${q} | sed 's/[^[:print:]]//')
# Populate files to update
if ! grep -q "$l" local.files; then
echo "$l" >> update.files
fi
done < android.files
script_dir=$(pwd)
cd $lfolder
while IFS= read -r q; do
# Remove non-printable characters (are not visible on console)
l=$(echo ${q} | sed 's/[^[:print:]]//')
echo "Get file: $l"
adb pull "$rfolder/$l"
done < "${script_dir}"/update.files

I have accidentally uninstalled jack server while building Android AOSP

I am building the Android code for Android Go on my ubuntu 14.04 machine.
While building I got some problems with jack server and I ended up uninstalling the jack server (accidentally).
How do I install the Jack Server again ?
I have tried to install the jack server using the following command:
jack-admin install-server jack-launcher.jar jack-server-4.11.ALPHA.jar
However, I get an error:
Jack server installation not found
Kindly help how do I install Jack Server again.
I have also followed guides from Google Search Result but it has not helped so far.
Update -1
After trying the answer from #gaoc I get the following error each time I try to make the build. :
[ 0% 19/82490] Ensuring Jack server is installed and started
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "/home/c_sganig/.jack-server"
Communication error with Jack server (3), try 'jack-diagnose' or see Jack server log
Communication error with Jack server 3. Try 'jack-diagnose'
Communication error with Jack server 3. Try 'jack-diagnose'
[ 0% 34/82490] build out/target/product/msm8909go/emmc_appsboot.mbn
make: Entering directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
including app/aboot dev/fbcon dev/gcdb/display dev/keys dev/pmic/pm8x41 dev/pmic/pmi8994 dev/qpnp_haptic dev/vib lib/debug lib/heap lib/libc lib/libfdt lib/openssl lib/ptable
including lib/openssl/crypto lib/zlib_inflate
make[1]: Entering directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
generating ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/config.h
generating ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/system-onesegment.ld
linking ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(bpabi.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(_divdi3.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(_udivdi3.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
generating image: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.bin
generating listing: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.lst
generating symbols: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.sym
generating listing: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.debug.lst
text data bss dec hex filename
367924 200272 202520 770716 bc29c ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-objcopy -O binary ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.bin
generating size map: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.size
generating stripped elf: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk_s.elf
cp -f ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk_s.elf ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/../../emmc_appsboot.mbn
make[1]: Leaving directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
make: Leaving directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
ninja: build stopped: subcommand failed.
11:47:18 ninja failed with: exit status 1
#### failed to build some targets (45 seconds) ####
Show the list of removed packages:
$ awk '$3 == "remove" { print $1, $2, $4 }' /var/log/dpkg.log | tee list
If you can find the removed package in the list, then reinstall:
$ sudo apt-get install --reinstall nameofpackage
Following is the solution that helped me with jack server issue:
Delete ~/.jack-server directory and ~/.jack.settings file. This will be recreated when we run make command, so nothing to worry about that.
Sync repo again using this command (takes about 30-40 minutes):
repo sync -c --no-clone-bundle --no-tags -j4
This -c option with sync command will tell the git about branch you really need instead of all repositories. -jn (-j4 in my case) , here n refers to the number of threads you want.
Now build environment , lunch and make as usual.
I will also share another link to Google Group which has some significant information regarding this issue. : https://issuetracker.google.com/issues/37070263

Building with autotools: AC_CONFIG_MACRO_DIRS conflicts with ACLOCAL.AMFLAGS

Trying to build libwally-core C library for Android on Windows in Cygwin with supplied autotools scripts:
libwally-core
After running
bash tools/build_android_libraries.sh
or
bash tools/autogen.sh
I get the following error:
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: error: AC_CONFIG_MACRO_DIRS([build-aux/m4]) conflicts with
ACLOCAL.AMFLAGS=-I build-aux/m4
autoreconf-2.69: libtoolize failed with exit status: 1
I tried the following things to no avail:
Re-saved all scripts with Unix line-endings (LF only)
Commenting out "ACLOCAL_AMFLAGS = -I tools/build-aux/m4" in Makefile.am
The error happens at the following place in libtool's source in libtoolize.in:
macrodir="$ac_macrodir"
test -z "$macrodir" && macrodir="$am_macrodir"
if test -n "$am_macrodir" && test -n "$ac_macrodir"; then
test "$am_macrodir" = "$ac_macrodir" \
|| func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macrodir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macrodir."
fi
I assume that the above makes sure that AC_CONFIG_MACRO_DIR and value after "-I" in ACLOCAL_AMFLAGS are identical (checked for identical line endings with hex editor too). The values are identical in both configure.ac and Makefile.am. However, even if I comment out setting ACLOCAL_AMFLAGS in Makefile.am, the error persits.
I would like to compile the library and generate libwallycore.so. Any insight would be much appreciated.

Cucumber android error while running feature

I'm trying to test android program with cucumber test.
I have such error:
C:\Users\Artem\calabash_habr>cucumber features/my_first.feature
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
Feature: Pre-orders feature
# Header
Scenario: open Pre-orders # features\my_first.feature:3
W/asset ( 2200): Asset path is neither a directory nor file (type=1).
ERROR: dump failed because assets could not be loaded 'package' not found in aapt output (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/helpers.rb:10:in `package_name'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/operations.rb:89:in `uninstall_apps'
C:/Users/Artem/calabash_habr/features/support/app_installation_hooks.rb:22:in `Before'
W/asset ( 8772): Asset path is neither a directory nor file (type=1).
ERROR: dump failed because assets could not be loaded
'package' not found in aapt output (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/helpers.rb:10:in `package_name'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/operations.rb:508:in `start_test_server_in_background'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/operations.rb:110:in `start_test_server_in_background'
C:/Users/Artem/calabash_habr/features/support/app_life_cycle_hooks.rb:5:in `Before'
When I press the menu key # calabash-android-0.5.1/lib/calabash-android/steps/navigation_steps.rb:5
Could not take screenshot (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/operations.rb:425:in `screenshot'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.1/lib/calabash-android/operations.rb:118:in `screenshot_embed'
C:/Users/Artem/calabash_habr/features/support/app_life_cycle_hooks.rb:10:in `After'
Failing Scenarios:
cucumber features\my_first.feature:3 # Scenario: open Pre-orders
1 scenario (1 failed)
1 step (1 skipped)
0m0.217s
My feature is easy:
Feature: Pre-orders feature
# Header
Scenario: open Pre-orders
# Menu press
When I press the menu key
I want to start feature without reinstalling app, because I want to save data.
P.S. I can run calabash console without error.
I change app_installation_hooks.rb so:
require 'calabash-android/management/app_installation'
AfterConfiguration do |config|
FeatureNameMemory.feature_name = nil
end
Before do |scenario|
#scenario_is_outline = (scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
if #scenario_is_outline
scenario = scenario.scenario_outline
end
feature_name = scenario.feature.title
if FeatureNameMemory.feature_name != feature_name \
or ENV["RESET_BETWEEN_SCENARIOS"] == "1"
if ENV["RESET_BETWEEN_SCENARIOS"] == "1"
log "New scenario - reinstalling apps"
else
log "First scenario in feature - reinstalling apps"
end
# uninstall_apps
# install_app(ENV["TEST_APP_PATH"])
# install_app(ENV["APP_PATH"])
FeatureNameMemory.feature_name = feature_name
FeatureNameMemory.invocation = 1
else
FeatureNameMemory.invocation += 1
end
end
FeatureNameMemory = Class.new
class << FeatureNameMemory
#feature_name = nil
attr_accessor :feature_name, :invocation
end
After now I run app:
calabash-android run <apk>

Categories

Resources