pilgun / acvtool Goto Github PK
View Code? Open in Web Editor NEWACVTool (Android Code Coverage Tool) is a tool to measure fine-grained code coverage of 3rd-party Android apps.
License: Apache License 2.0
ACVTool (Android Code Coverage Tool) is a tool to measure fine-grained code coverage of 3rd-party Android apps.
License: Apache License 2.0
I test both of the tools in the Activitydiary (https://github.com/ramack/ActivityDiary), but they got great differences under same test sequences. I got about 50% instruction coverage from Jacoco but only 16% by ACVTool. I know they work in different conditions but i wonder why there is a huge gap here.
Hello....
thank you for your code ... I tried to use it in Ubuntu 16.04.6 LTS (Xenial Xerus).... I install all the requirements mentioned in the read-me file .. when an I installed it without any error
when I tried the acv -h instruction the following error came up:
File "/home/hayyan/Desktop/acvtool/acvtool.py", line 8, in
from smiler import smiler
File "/home/hayyan/Desktop/acvtool/smiler/smiler.py", line 10, in
from config import config
ImportError: No module named 'config'
Any ideas??
Best regards...
I am using a Windows OS. To instrument I used acv instrument C:\Users\micha\AndroidStudioProjects\wifisetup\wifisetup\app\build\outputs\apk\debug\app-debug.apk
Then to install I has to use acv install C:\Users\micha\AndroidStudioProjects\wifisetup\wifisetup\app\build\outputs\apk\debug\app-debug.apk
Then to start acv start nl.eventinfra.wifisetup
I get the following error:
Operation not allowed: java.lang.SecurityException: Can't change android.permission.READ_EXTERNAL_STORAGE. It is required by the application
Operation not allowed: java.lang.SecurityException: Can't change android.permission.WRITE_EXTERNAL_STORAGE. It is required by the application
Press Ctrl+C to finish ...
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{nl.eventinfra.wifisetup/tool.acv.AcvInstrumentation}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: nl.eventinfra.wifisetup/tool.acv.AcvInstrumentation
at com.android.commands.am.Am.runInstrument(Am.java:977)
at com.android.commands.am.Am.onRun(Am.java:317)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:97)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
Good morning, I am a macOS user with Intel core i9 operating system.
I've been trying to use your tool with various different applications for days now but whatever the application, even the most trivial I can't instrument it.
After running the command
acv instrument /path/to/file.apk
, I sit on hold for hours never receiving anything.
How come I can't instrument the apk?
All your prerequisites are met:
I have the following problem when I combine the acvtool with automated testing tools. I first use the command "acv start com.ichi2.anki" to start the instrument process,then I testing the application with automated testing tools,and then when it run to the fifth minute,there is a crash below and the "acv start ..." process is terminated and stops running. So the .ec file not be generated after the process crash. Can you help me?
Problem:
jie@jie-Legion-Y9000P-IAH7H:~/acvtool/acvtool_working_dir$ acv start com.ichi2.anki
Press Ctrl+C to finish ...
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
jie@jie-Legion-Y9000P-IAH7H:~/acvtool/acvtool_working_dir$
I'm working on a project where I'm generating test inputs for android apps and exercising the apps with appium
. When tracking the coverage using acvtool, the .ec
files sometimes appear and at other times do not - its not clear why. avctool
works well when running from terminal only but when I'm scripting it as part of a larger testing flow in python, it hangs sometimes.
Here is the console output when it works:
======================================================================================== test session starts ========================================================================================
platform linux -- Python 3.7.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/fabrice/Documents/GitHub/AndroidMLTesting/app_tester
collected 4 items / 3 deselected / 1 selected
tests/test_photoai.py [AMLT] uninstalling existing apk...
Success
[AMLT] installing instrumented apk...
[AMLT] amlt_py2: acv install /home/fabrice/acvtool/acvtool_working_dir/instr_photoai.apk
installing
Performing Streamed Install
Success
[AMLT] start coverage monitoring...
[AMLT] amlt_py2: acv start com.soumio.mikes.photoai -q
.[AMLT] stop coverage monitoring...
[AMLT] amlt_py2: acv stop com.soumio.mikes.photoai -t 10
finish testing
Broadcasting: Intent { act=tool.acv.finishtesting }
Broadcast completed: result=0
0
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
wait until the coverage file is saved com.soumio.mikes.photoai
coverage files at /mnt/sdcard/com.soumio.mikes.photoai:
onstop_coverage_1666376900357.ec
onstop_coverage_1666376934125.ec
onstop_coverage_1666376943471.ec
[AMLT] generating coverage report...
[AMLT] amlt_py2: acv report com.soumio.mikes.photoai -p ~/acvtool/acvtool_working_dir/metadata/photoai.pickle -o ./coverage_reports
mnt/sdcard/com.soumio.mikes.photoai/onstop_coverage_1666376900357.ec: 1 file pulled, 0 skipped. 68.1 MB/s (155726 bytes in 0.002s)
mnt/sdcard/com.soumio.mikes.photoai/onstop_coverage_1666376934125.ec: 1 file pulled, 0 skipped. 74.7 MB/s (155726 bytes in 0.002s)
mnt/sdcard/com.soumio.mikes.photoai/onstop_coverage_1666376943471.ec: 1 file pulled, 0 skipped. 69.9 MB/s (155726 bytes in 0.002s)
report generating...
report saved: ./coverage_reports/com.soumio.mikes.photoai/report
[AMLT] stopping emulator...
OK: killing emulator, bye bye
OK
[AMLT] stopping appium...
Here is an example of it not working:
======================================================================================== test session starts ========================================================================================
platform linux -- Python 3.7.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/fabrice/Documents/GitHub/AndroidMLTesting/app_tester
collected 4 items
tests/test_ai_objects.py s
tests/test_extra_eye.py s
tests/test_gstai.py apk not installed...
[AMLT] installing instrumented apk...
[AMLT] amlt_py2: acv install /home/fabrice/acvtool/acvtool_working_dir/instr_gstai.apk
installing
Performing Streamed Install
Success
[AMLT] start coverage monitoring...
[AMLT] amlt_py2: acv start gst.ailab.lite.examples.classification -q
.[AMLT] stop coverage monitoring...
[AMLT] amlt_py2: acv stop gst.ailab.lite.examples.classification -t 10
finish testing
Broadcasting: Intent { act=tool.acv.finishtesting }
Broadcast completed: result=0
0
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
wait until the coverage file is saved gst.ailab.lite.examples.classification
coverage files at /mnt/sdcard/gst.ailab.lite.examples.classification:
[AMLT] generating coverage report...
[AMLT] amlt_py2: acv report gst.ailab.lite.examples.classification -p ~/acvtool/acvtool_working_dir/metadata/gstai.pickle -o ./coverage_reports
Traceback (most recent call last):
File "/home/fabrice/miniconda3/envs/amlt_py2/bin/acv", line 11, in <module>
load_entry_point('acvtool', 'console_scripts', 'acv')()
File "/home/fabrice/Documents/GitHub/acvtool/acvtool.py", line 217, in main
run_actions(parser, args)
File "/home/fabrice/Documents/GitHub/acvtool/acvtool.py", line 88, in run_actions
granularity=args.granularity)
File "/home/fabrice/Documents/GitHub/acvtool/smiler/reporter.py", line 28, in generate
smiler.get_execution_results(package, ec_dir)
File "/home/fabrice/Documents/GitHub/acvtool/smiler/smiler.py", line 74, in get_execution_results
Run acvtool with \'-start\' argument to produce coverage.".format(package_name))
[app_tester.zip](https://github.com/pilgun/acvtool/files/9842052/app_tester.zip)
Exception: No coverage or crash report files have been detected on the device for gst.ailab.lite.examples.classification package.
Run acvtool with '-start' argument to produce coverage.
ERROR conda.cli.main_run:execute(49): `conda run acv report gst.ailab.lite.examples.classification -p /home/fabrice/acvtool/acvtool_working_dir/metadata/gstai.pickle -o ./coverage_reports` failed. (See above for error)
Initial thoughts: something in the emulator needs to be reset (e.g. the sdcard storage cleared) to work properly.
Ubuntu 22.04
Python=3.9 (all acv
commands are run through a Python=2.7 conda environment)
Is the fact that only first smali dir can be instrumented when my app have more than one dex file?
Hi,
I run all the steps successfully and the coverage report is also generated. But the problem is that the report contains coverage information only for Android API, I mean android.support.* packages, and it does not include any of the application packages.
(I have attached the report HTML file)
Your help on this is highly appreciated.
Thanks,
Samad
index.zip
Hello,
I completed all sections. When I run "acv -h" command, it says that no mdule named "config" in smiler.py. I think that there is problem with naming in the python files because I modified import section smiler.config instead of config. However, it starts to give error another naming related folders. I changed many parts but still it is not working. Do you have any idea about the problem?
Note: I use python 3.6.0. Does it make a problem?
Hi, I'm insterested in what you show in the post, but I have anymore to use apk in my app to submit a Play Store so I have a question. Did you support for aab or any plan to support?
Thank you
Hi, I have successfully instrumented this app https://f-droid.org/en/packages/me.lucky.silence/. The install gives an exception because it tries a incremental install but then tries a streamed install that succeeds. When I try to start the app it immediately crashes.
When I try to instrument https://f-droid.org/en/packages/com.kylecorry.trail_sense/, I get:
I have updated apktool to the most recent version, as suggested in another issue, but I still get "Unable to open as zip archive."
Any ideas?
Hello, I am a Macbook pro owner with an Apple Silicon processor. I have tried to test ACV with various apks
When I run the acv instrument <path>
command, I get different but similar errors each time. For example:
acv instrument shazam-13-27-0-230420.apk
The working directory exists and may contain data: /Users/francesco/acvtool/acvtool_working_dir
Overwrite (y/n)? y
decompiled com.shazam.android
parsing /Users/francesco/acvtool/acvtool_working_dir/apktool/com.shazam.android/smali...
saving instrumented smali: /Users/francesco/acvtool/acvtool_working_dir/apktool/com.shazam.android/smali...
pickle file saved: /Users/francesco/acvtool/acvtool_working_dir/metadata/shazam-13-27-0-230420.pickle
instrumented
Exception in thread "main" org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Ltool/acv/AcvReporter;->saveExternalPublicFile(Ljava/io/File;)V
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:917)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:341)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:297)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:61)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:36)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:418)
at brut.androlib.Androlib.buildSources(Androlib.java:349)
at brut.androlib.Androlib.build(Androlib.java:301)
at brut.androlib.Androlib.build(Androlib.java:268)
at brut.apktool.Main.cmdBuild(Main.java:251)
at brut.apktool.Main.main(Main.java:79)
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 69311
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1212)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:913)
... 10 more
built
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/py27/bin/acv", line 11, in <module>
load_entry_point('acvtool', 'console_scripts', 'acv')()
File "/Users/francesco/Desktop/acvtool/acvtool.py", line 217, in main
run_actions(parser, args)
File "/Users/francesco/Desktop/acvtool/acvtool.py", line 52, in run_actions
mem_stats=args.memstats)
File "/Users/francesco/Desktop/acvtool/smiler/instrumenting/utils.py", line 107, in wrapper
result = method(*args, **kwargs)
File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 186, in instrument_apk
sign_align_apk(instrumented_package_path, instrumented_apk_path)
File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 277, in sign_align_apk
request_pipe(align_cmd)
File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 47, in request_pipe
Out: %s\nError: %s" % (out, err))
Exception: ----------------------------------------------------
Out:
Error: Unable to open '/Users/francesco/acvtool/acvtool_working_dir/shazam-13-27-0-230420.apk' as zip archive
I would appreciate it if you could help me.
Thank you so much.
My app use retrofit to send http request, apk can't work after instrumented.
Error message below:
"No Retrofit annotation found (parameter #1) for method ....."
Hello!
I am tried to instrument some apk`s, but all of them are failed with the same error. There is result of AIMP instrumentation, as example:
python2.7 acvtool.py instrument ../aimp_4.02.1368.apk
The working directory exists and may contain data: /home/sadovnikov/acvtool/acvtool_working_dir
Overwrite (y/n)? y
decompiled com.aimp.player
parsing /home/sadovnikov/acvtool/acvtool_working_dir/apktool/com.aimp.player/smali...
saving instrumented smali: /home/sadovnikov/acvtool/acvtool_working_dir/apktool/com.aimp.player/smali...
pickle file saved: /home/sadovnikov/acvtool/acvtool_working_dir/metadata/aimp_4.02.1368.pickle
instrumented
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_14631828153885591959.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 34, --version-code, 1368, --version-name, v4.02.1368 (20.09.2023), --no-version-vectors, -F, /tmp/APKTOOL10057241395823491847.tmp, -e, /tmp/APKTOOL2076583431270168081.tmp, -0, arsc, -I, /home/sadovnikov/.local/share/apktool/framework/1.apk, -S, /home/sadovnikov/acvtool/acvtool_working_dir/apktool/com.aimp.player/res, -M, /home/sadovnikov/acvtool/acvtool_working_dir/apktool/com.aimp.player/AndroidManifest.xml]
built
Traceback (most recent call last):
File "acvtool.py", line 220, in <module>
main()
File "acvtool.py", line 217, in main
run_actions(parser, args)
File "acvtool.py", line 52, in run_actions
mem_stats=args.memstats)
File "/home/sadovnikov/Desktop/android-studio-2022.3.1.20-linux/acvtool/smiler/instrumenting/utils.py", line 107, in wrapper
result = method(*args, **kwargs)
File "/home/sadovnikov/Desktop/android-studio-2022.3.1.20-linux/acvtool/smiler/smiler.py", line 186, in instrument_apk
sign_align_apk(instrumented_package_path, instrumented_apk_path)
File "/home/sadovnikov/Desktop/android-studio-2022.3.1.20-linux/acvtool/smiler/smiler.py", line 277, in sign_align_apk
request_pipe(align_cmd)
File "/home/sadovnikov/Desktop/android-studio-2022.3.1.20-linux/acvtool/smiler/smiler.py", line 47, in request_pipe
Out: %s\nError: %s" % (out, err))
Exception: ----------------------------------------------------
Out:
Error: Unable to open '/home/sadovnikov/acvtool/acvtool_working_dir/aimp_4.02.1368.apk' as zip archive
Can you advise what can be a reason of this problem?
Hi,
I want to use acvtool for code coverage while testing my application via Appium. I started the tool with the command "acv start ". After that, I wanted to run my test cases that I have written before by using Appium. When I started to Appium, I got this error.
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
How can I find the information related the error? I can not use acvtool by running test cases automatically as you mentioned in document. However, it is working manually.
Thanks,
decompiled cn.hjf.adaptiveicontest
parsing /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/smali...
saving instrumented smali: /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/smali...
pickle file saved: /Users/huangjinfu/acvtool/acvtool_working_dir/metadata/app-debug-2.pickle
instrumented
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/brut_util_Jar_3259402255641051421.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 1, --version-name, 1.0, --no-version-vectors, -F, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/APKTOOL228554042944328235.tmp, -0, arsc, -0, META-INF/android.arch.core_runtime.version, -0, META-INF/android.arch.lifecycle_livedata-core.version, -0, META-INF/android.arch.lifecycle_livedata.version, -0, META-INF/android.arch.lifecycle_runtime.version, -0, META-INF/android.arch.lifecycle_viewmodel.version, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, arsc, -I, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/1.apk, -S, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/res, -M, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:492)
at brut.androlib.Androlib.buildResources(Androlib.java:426)
at brut.androlib.Androlib.build(Androlib.java:305)
at brut.androlib.Androlib.build(Androlib.java:270)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:75)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/brut_util_Jar_3259402255641051421.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 1, --version-name, 1.0, --no-version-vectors, -F, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/APKTOOL228554042944328235.tmp, -0, arsc, -0, META-INF/android.arch.core_runtime.version, -0, META-INF/android.arch.lifecycle_livedata-core.version, -0, META-INF/android.arch.lifecycle_livedata.version, -0, META-INF/android.arch.lifecycle_runtime.version, -0, META-INF/android.arch.lifecycle_viewmodel.version, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, arsc, -I, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/1.apk, -S, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/res, -M, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:456)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/brut_util_Jar_3259402255641051421.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 1, --version-name, 1.0, --no-version-vectors, -F, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/APKTOOL228554042944328235.tmp, -0, arsc, -0, META-INF/android.arch.core_runtime.version, -0, META-INF/android.arch.lifecycle_livedata-core.version, -0, META-INF/android.arch.lifecycle_livedata.version, -0, META-INF/android.arch.lifecycle_runtime.version, -0, META-INF/android.arch.lifecycle_viewmodel.version, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, arsc, -I, /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/1.apk, -S, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/res, -M, /Users/huangjinfu/acvtool/acvtool_working_dir/apktool/cn.hjf.adaptiveicontest/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:95)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:450)
... 6 more
built
Traceback (most recent call last):
File "/usr/local/bin/acv", line 9, in
load_entry_point('acvtool==0.1', 'console_scripts', 'acv')()
File "/Users/huangjinfu/dev-tools/acvtool/acvtool.py", line 217, in main
run_actions(parser, args)
File "/Users/huangjinfu/dev-tools/acvtool/acvtool.py", line 52, in run_actions
mem_stats=args.memstats)
File "/Users/huangjinfu/dev-tools/acvtool/smiler/instrumenting/utils.py", line 107, in wrapper
result = method(*args, **kwargs)
File "/Users/huangjinfu/dev-tools/acvtool/smiler/smiler.py", line 186, in instrument_apk
sign_align_apk(instrumented_package_path, instrumented_apk_path)
File "/Users/huangjinfu/dev-tools/acvtool/smiler/smiler.py", line 277, in sign_align_apk
request_pipe(align_cmd)
File "/Users/huangjinfu/dev-tools/acvtool/smiler/smiler.py", line 47, in request_pipe
Out: %s\nError: %s" % (out, err))
Exception: ----------------------------------------------------
Out:
Error: Unable to open '/Users/huangjinfu/acvtool/acvtool_working_dir/app-debug-2.apk' as zip archive
Hi,
I am trying to instrument some apks using your tool. This is what I did so far.
"acv -h" command is not working properly. It's showing me the following error:
Traceback (most recent call last):
File "/home/khorrom/.local/bin/acv", line 11, in
load_entry_point('acvtool==0.1', 'console_scripts', 'acv')()
File "/home/khorrom/.local/lib/python2.7/site-packages/pkg_resources/init.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/khorrom/.local/lib/python2.7/site-packages/pkg_resources/init.py", line 2691, in load_entry_point
return ep.load()
File "/home/khorrom/.local/lib/python2.7/site-packages/pkg_resources/init.py", line 2322, in load
return self.resolve()
File "/home/khorrom/.local/lib/python2.7/site-packages/pkg_resources/init.py", line 2328, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/home/khorrom/acvtool/acvtool.py", line 8, in
from smiler import smiler
File "/home/khorrom/acvtool/smiler/smiler.py", line 9, in
from config import config
File "/home/khorrom/acvtool/smiler/config.py", line 11, in
class config(object):
File "/home/khorrom/acvtool/smiler/config.py", line 22, in config
config_data = json.load(json_file)
File "/usr/lib/python2.7/json/init.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 6 column 1 (char 274)
Please let me know if I am doing anything wrong. My operating system is ubuntu and I have java and python installed.
Thank you!
Hello
I'm using ubuntu 18.04 64bit on wsl with python 2.7 on anaconda. I cloned the repo. Opened the repo...ran python install -e . and setup.py. However, If I run "acv - h", I get the error "No module named acvtool". I'm not sure whats wrong there. Can anyone help?
Hi,
I have four .ec files by executing four tests on the same app, but the reported coverage from two of the .ec files is HIGHER than the coverage from all four of them. This is strange to me because intuitively the cumulative coverage should be only increased by adding more .ec files. Specifically, I have the following metadata and two ec folders:
q
├── astro.pickle
├── ec1
│ ├── onstop_coverage_1610318914750.ec
│ └── onstop_coverage_1610318965061.ec
└── ec2
├── onstop_coverage_1610318902020.ec
├── onstop_coverage_1610318914750.ec
├── onstop_coverage_1610318947862.ec
└── onstop_coverage_1610318965061.ec
After executing acv report com.metago.astro -p ~/q/astro.pickle -ec ~/q/ec1 -o ~/q
, I got a coverage: 76534 of 627614 | 12.19444%
Then, after executing acv report com.metago.astro -p ~/q/astro.pickle -ec ~/q/ec2 -o ~/q
, I got a coverage: 69355 of 627614 | 11.05058%
This is weird because the files in ec1 are also in ec2. How can the cumulative coverage decrease by just adding more .ec files?
The files can be downloaded here:
https://drive.google.com/file/d/1W---ONiffuW9Shje1Hth2lgkghQY-5H0/view?usp=sharing
Hi, is there any way (or will there any way in the future) for acvtool to obtain code coverage for an app even when the app crashes?
I have a sample set of APKs that work fine on Sapienz for Android Emulator 4.4 (as it is stated that Sapienz supports Android 4.4). However, when I try them on newer versions of Android such as Android 5, 7, 8, 10, and 11, Sapienz does not seem to generate any activity for testing. I wonder how I can run the instrumented APKs on newer versions of Android then running the test from Sapienz.
I am attempting to use acvtool to find the coverage of some tests on the Antennapod open source application. I can run acvtool and measure the coverage of manual input however not instrumented tests. I have installed the instrumented version of the application and the test package. When I run the command:
adb shell am instrument -w de.test.antennapod/androidx.test.runner.AndroidJUnitRunner
I get the error message:
java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{de.test.antennapod/androidx.test.runner.AndroidJUnitRunner} from pid=7420, uid=7420 not allowed because package de.test.antennapod does not have a signature matching the target de.danoeh.antennapod.debug
at android.os.Parcel.createException(Parcel.java:2071)
INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{de.test.antennapod/androidx.test.runner.AndroidJUnitRunner} from pid=7420, uid=7420 not allowed because package de.test.antennapod does not have a signature matching the target de.danoeh.antennapod.debug
at android.os.Parcel.readException(Parcel.java:2039)
INSTRUMENTATION_STATUS: id=ActivityManagerService
at android.os.Parcel.readException(Parcel.java:1987)INSTRUMENTATION_STATUS_CODE: -1
at android.app.IActivityManager$Stub$Proxy.startInstrumentation(IActivityManager.java:5441)
at com.android.commands.am.Instrument.run(Instrument.java:512)
at com.android.commands.am.Am.runInstrument(Am.java:196)
at com.android.commands.am.Am.onRun(Am.java:80)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:56)
at com.android.commands.am.Am.main(Am.java:50)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:338)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.startInstrumentation(ActivityManagerService.java:15744)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2350)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
Greetings!
I am using Windows OS. I use the following commands
acv instrument csnake.apk
acv install csnake.apk
And get following error while trying to install:
Performing Push Install
instr_csnake.apk: 1 file pushed, 0 skipped. 119.3 MB/s (10680231 bytes in 0.085s)
pkg: /data/local/tmp/instr_csnake.apk
Failure [INSTALL_FAILED_DEXOPT]
app: com.gnsdm.snake
emulator: Nexus 6 API 22
Thanks.
I want to get the report of the application using acv tool after running(using the acv start command) it for 10 seconds. Could you please explain a bit about what changes would be required to be made to automatically timeout the application after 10 seconds instead of keyboard interrupt.
Hi,
first, thank you for your tool! I was able to successfully use it for many apps that I downloaded from the Google Play Store. There are some apps, however, for which I get the following error:
decompiled com.doodle.master.draw.glow.art
parsing /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/smali...
saving instrumented smali: /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/smali...
pickle file saved: /home/piccolboni/acvtool/acvtool_working_dir/metadata/com.doodle.master.draw.glow.art_15.pickle
instrumented
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_3088596633158174997.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 15, --version-name, 1.0.9, --no-version-vectors, -F, /tmp/APKTOOL13427459794017075638.tmp, -0, arsc, -0, arsc, -I, /home/piccolboni/.local/share/apktool/framework/1.apk, -S, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/res, -M, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:492)
at brut.androlib.Androlib.buildResources(Androlib.java:426)
at brut.androlib.Androlib.build(Androlib.java:305)
at brut.androlib.Androlib.build(Androlib.java:270)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:75)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_3088596633158174997.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 15, --version-name, 1.0.9, --no-version-vectors, -F, /tmp/APKTOOL13427459794017075638.tmp, -0, arsc, -0, arsc, -I, /home/piccolboni/.local/share/apktool/framework/1.apk, -S, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/res, -M, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:456)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_3088596633158174997.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 15, --version-name, 1.0.9, --no-version-vectors, -F, /tmp/APKTOOL13427459794017075638.tmp, -0, arsc, -0, arsc, -I, /home/piccolboni/.local/share/apktool/framework/1.apk, -S, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/res, -M, /home/piccolboni/acvtool/acvtool_working_dir/apktool/com.doodle.master.draw.glow.art/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:95)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:450)
... 6 more
built
Traceback (most recent call last):
File "acvtool/acvtool.py", line 220, in <module>
main()
File "acvtool/acvtool.py", line 217, in main
run_actions(parser, args)
File "acvtool/acvtool.py", line 52, in run_actions
mem_stats=args.memstats)
File "/home/piccolboni/Android/work/acvtool/smiler/instrumenting/utils.py", line 107, in wrapper
result = method(*args, **kwargs)
File "/home/piccolboni/Android/work/acvtool/smiler/smiler.py", line 186, in instrument_apk
sign_align_apk(instrumented_package_path, instrumented_apk_path)
File "/home/piccolboni/Android/work/acvtool/smiler/smiler.py", line 277, in sign_align_apk
request_pipe(align_cmd)
File "/home/piccolboni/Android/work/acvtool/smiler/smiler.py", line 47, in request_pipe
Out: %s\nError: %s" % (out, err))
Exception: ----------------------------------------------------
Out:
Error: Unable to open '/home/piccolboni/acvtool/acvtool_working_dir/com.doodle.master.draw.glow.art_15.apk' as zip archive
Thank you!
after a successful install on my linux machine, I attempt to run acv -h. I am then met with "command 'acv' not found, did you mean: "
everything else has worked up to this point
Hey,
I was just trying to use acvtool with my non-rooted moto g40 fusion running android12.
I was just testing this tool on a simply 2048 game.
I can instrument the apk just fine and install it. But when I try to run it using acv start <package.name>
it doesnt start the apk. In the terminal it says Press Ctrl+C to finish ...
but I have to start the app manually.
After opening the app manually and interacting with it for a while I press Ctrl+C and get the following error
Exception Exception: Exception('----------------------------------------------------\nOut: \nError: ls: /mnt/sdcard/com.tpcstld.twozerogame/: Permission denied\n',) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
This is the apk link https://m.apkpure.com/2048/com.tpcstld.twozerogame/download
Screenshots for your reference:-
From the looks of it, it should work if phone or atleast adb is rooted.
So just to confirm will this tool require root, or can it work without root as well?
So now that the acvtool is installed correctly, I get the following error when trying to instrument.
Traceback (most recent call last):
File "C:\Python27\Scripts\acv-script.py", line 11, in
load_entry_point('acvtool', 'console_scripts', 'acv')()
File "c:\python27\lib\site-packages\pkg_resources_init_.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\python27\lib\site-packages\pkg_resources_init_.py", line 2631, in load_entry_point
return ep.load()
File "c:\python27\lib\site-packages\pkg_resources_init_.py", line 2291, in load
return self.resolve()
File "c:\python27\lib\site-packages\pkg_resources_init_.py", line 2297, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "c:\acvtool-master\acvtool.py", line 8, in
from smiler import smiler
File "c:\acvtool-master\smiler\smiler.py", line 9, in
from config import config
File "c:\acvtool-master\smiler\config.py", line 11, in
class config(object):
File "c:\acvtool-master\smiler\config.py", line 22, in config
config_data = json.load(json_file)
File "c:\python27\lib\json_init_.py", line 291, in load
**kw)
File "c:\python27\lib\json_init_.py", line 339, in loads
return _default_decoder.decode(s)
File "c:\python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\python27\lib\json\decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid \escape: line 2 column 14 (char 15)
What is this supposed to mean?
INSTRUMENTATION_RESULT: shortMsg=keyDispatchingTimedOut
INSTRUMENTATION_RESULT: longMsg=Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
INSTRUMENTATION_CODE: 0
It seems to me if the application under test crashes, acvtool also crashes...no more reports.
How does it handle crashes then?
Hi,
During report generation, I am getting the following crash with acv.
File "/home/priyanka/.local/bin/acv", line 11, in <module>
load_entry_point('acvtool', 'console_scripts', 'acv')()
File "/home/priyanka/research/projects/androidtest/coverage/acvtool.py", line 217, in main
run_actions(parser, args)
File "/home/priyanka/research/projects/androidtest/coverage/acvtool.py", line 88, in run_actions
granularity=args.granularity)
File "/home/priyanka/research/projects/androidtest/coverage/smiler/reporter.py", line 33, in generate
smalitree = get_covered_smalitree(ec_files, pickle_path)
File "/home/priyanka/research/projects/androidtest/coverage/smiler/reporter.py", line 60, in get_covered_smalitree
cover_smalitree(st, coverage)
File "/home/priyanka/research/projects/androidtest/coverage/smiler/reporter.py", line 286, in cover_smalitree
method.called = method.cover_code > -1 and cov_class[method.cover_code]
IndexError: list index out of range
Is this some issue with apk itself or with acv tool? Please help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.