Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Mobile Testing, Android App Testing.
an_snust
Posts: 6
Joined: Sun Jan 28, 2018 4:32 pm

Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Post by an_snust » Wed Feb 16, 2022 4:07 am

I am using following environment to instrument apk file
Android OS 9
Ranorex service 2.3.3
Ranorex ver 10.1.6

I am facing 2 problems
- Ranorex service shows Warning and I can not turn off this Warning even I turn on all permissions
- When I instrument the apk file, it shows Operation failed

Code: Select all

System.InvalidOperationException: Failed to decompile the APK file. See details for more information: Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
	at brut.androlib.ApkDecoder.hasResources(ApkDecoder.java:290)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:96)
	at brut.apktool.Main.cmdDecode(Main.java:175)
	at brut.apktool.Main.main(Main.java:78)
Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
	at brut.directory.ExtFile.getDirectory(ExtFile.java:49)
	at brut.androlib.ApkDecoder.hasResources(ApkDecoder.java:288)
	... 3 more
Caused by: java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:225)
	at java.util.zip.ZipFile.<init>(ZipFile.java:155)
	at java.util.zip.ZipFile.<init>(ZipFile.java:169)
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
	... 6 more

   at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.DecompileApkFile(String apkFilePath, Boolean showProcessWindows, IPathService pathService, InstrumentApkOptions deployOptions)
   at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
   at Ranorex.Plugin.Mobile.RxIntegration.Instrumentation.AndroidWorker.Run()
   at Ranorex.Controls.Instrumentation.ViewModels.Pages.DeployingAndroidAppPageViewModel.<>c__DisplayClass48_0.<DoInstrumentationWork>b__0()
Could anyone help me check this problem?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7465
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Post by odklizec » Wed Feb 16, 2022 7:52 am

Hi,

The error message looks like the apk is either corrupted or somehow protected from decompilation. Please make sure the APK is not corrupted (download it again) and not encrypted or obfuscated (ask the app developers about the obfuscation/encryption status of the given apk).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

an_snust
Posts: 6
Joined: Sun Jan 28, 2018 4:32 pm

Re: Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Post by an_snust » Wed Feb 16, 2022 8:48 am

Hi,

I found out the way to solve these problems.
Thanks!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7465
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Post by odklizec » Wed Feb 16, 2022 9:02 am

Hi,

Could you please share the source of issue? Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

an_snust
Posts: 6
Joined: Sun Jan 28, 2018 4:32 pm

Re: Unable to instrument apk file on Android 9 with Ranorex 10.1.6

Post by an_snust » Tue Feb 22, 2022 3:21 am

Hi,
Because my apk is under development so I can not share it.
My apk is signing apk. so when I instrument on Android 9, I need to fill all information in Signing Apk. However, the enigmatic thing is that I dont need to do this with later Android (Android 10 or 11).