Error during Instrumentation of apk file

Mobile Testing, Android App Testing.
Posts: 6
Joined: Tue Oct 20, 2015 9:00 am

Error during Instrumentation of apk file

Post by sudheer.punreddy » Tue Oct 20, 2015 9:09 am

Hello All,

We are using RXStudio 5.4.0 and automating mobile application Android APK.

While we are trying to Instrument the apk file, we faced the below error.

Instrumentation failed.

Please make sure that your apk is not obfuscated (we tested with both obfuscated and non obfuscated versions)
You are using API level 8 or above (API level is above 15)
No non instrumented apk version is installed onthe device (We ensured the same)

System.Exception: Failed to decompile the APK file. See details for more information: Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
at brut.androlib.res.decoder.ARSCDecoder.decode(
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(
at brut.androlib.res.AndrolibResources.loadMainPkg(
at brut.androlib.res.AndrolibResources.getResTable(
at brut.androlib.Androlib.getResTable(
at brut.androlib.ApkDecoder.setTargetSdkVersion(
at brut.androlib.ApkDecoder.decode(
at brut.apktool.Main.cmdDecode(
at brut.apktool.Main.main(
Caused by: Expected: 0x00000008, got: 0x00000001
at brut.util.ExtDataInput.skipCheckShort(
at brut.androlib.res.decoder.ARSCDecoder.readValue(
at brut.androlib.res.decoder.ARSCDecoder.readEntry(
at brut.androlib.res.decoder.ARSCDecoder.readConfig(
at brut.androlib.res.decoder.ARSCDecoder.readType(
at brut.androlib.res.decoder.ARSCDecoder.readPackage(
at brut.androlib.res.decoder.ARSCDecoder.readTable(
at brut.androlib.res.decoder.ARSCDecoder.decode(
... 8 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, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
at Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)

Can anybody lookintothe issue and help us in fixing the same.

Thanks in advance..

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Error during Instrumentation of apk file

Post by Support Team » Thu Oct 22, 2015 12:25 pm

Hi Sudheer.punreddy,

Unfortunately the error ‘Failed to decompile the APK file’ is provided by the APK tool, which is a third-party application.
In order to overcome this problem, I’d suggest updating Ranorex to the latest version.

Ranorex 5.4.3 comes already with the latest APK tool, which should be able to decompile your application.
Please have a look at the new features, bug fixes and breaking changes, which can be found in the release notes.

Additionally, before running the Instrumentation Wizard, please delete the 1.apk-file from the directory ‘%userprofile%\apktool\framework\

Please let me know if the problem still occurs after updating.

Markus (S)