H2SO4T / COSMO

Automatically instrument gradle-based applications and generate code coverage reports
MIT License
13 stars 3 forks source link

Error during Java to Dalvik conversion command #2

Open shiyuanxiang opened 1 year ago

shiyuanxiang commented 1 year ago

command: python .\cli.py path_to_my.apk (I tried several apps, official and my own. Both got the error below.) 18/10/2022 22:52:40> [ERROR][apk_instrumenter][instrument_apk()] Error during Java to Dalvik conversion command: Uncaught translation error: com.android.dx.cf.code.SimException: expected type long[] but found double[] 1 error; aborting

H2SO4T commented 1 year ago

Are you instrumenting from source or from the apk? However as written here https://github.com/H2SO4T/COSMO#cosmo-from-apk-usage COSMO can instrument only certain debug apks (have a look to the paper for more information ). I suggest you to instrument apps from source code.

shiyuanxiang commented 1 year ago

Thanks for your answer! I have instrumented from both debug-apk and release-apk, but got the error still. And how do I instrument apps from source code?😊

H2SO4T commented 1 year ago

To instrument from source code: 1: Download an Android project (e.g., https://github.com/AntennaPod/AntennaPod) 2: copy the path to the Android project (e.g., /Users/andreronda/Downloads/MyProject ) 3: from the Cosmo folder launch the command python3 cli.py /Users/andreronda/Downloads/MyProject

shiyuanxiang commented 1 year ago

download the AntennaPod in dir:C:\Users\syx\Desktop\garbage\AntennaPod-develop run cmd in COSMO dir: python cli.py C:\Users\syx\Desktop\garbage\AntennaPod-develop output: image Is that means the Instrumentation successful or not? If successful, where is the instrumented files?

shiyuanxiang commented 1 year ago

I have created this apk already instrumented, please try it [test.apk]()

It can't be download

H2SO4T commented 1 year ago

never mind

download the AntennaPod in dir:C:\Users\syx\Desktop\garbage\AntennaPod-develop run cmd in COSMO dir: python cli.py C:\Users\syx\Desktop\garbage\AntennaPod-develop output: image Is that means the Instrumentation successful or not? If successful, where is the instrumented files?

Yes now it is instrumented!

shiyuanxiang commented 1 year ago

never mind

download the AntennaPod in dir:C:\Users\syx\Desktop\garbage\AntennaPod-develop run cmd in COSMO dir: python cli.py C:\Users\syx\Desktop\garbage\AntennaPod-develop output: image Is that means the Instrumentation successful or not? If successful, where is the instrumented files?

Yes now it is instrumented!

So I shall build a debug-apk from the AntennaPod project, and use the debug-apk in ARES?

H2SO4T commented 1 year ago

exactly, now you can build the apk using Android Studio!

shiyuanxiang commented 1 year ago

Thank you very much! I have sucessfully got the .ec files, but if how could I calculate the code coverage from the .ec files? Here is the result with cmd: cat xx.ec image

H2SO4T commented 1 year ago

Read the readme in the home page under the section: Generating a HTML/CSV report https://github.com/H2SO4T/COSMO#generating-a-htmlcsv-report