Error during Instrumentation of apk file

Mobile Testing, Android App Testing.
sudheer.punreddy
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(ARSCDecoder.java:52)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:538)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:63)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:55)
at brut.androlib.Androlib.getResTable(Androlib.java:64)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:209)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:92)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
Caused by: java.io.IOException: Expected: 0x00000008, got: 0x00000001
at brut.util.ExtDataInput.skipCheckShort(ExtDataInput.java:56)
at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:238)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:201)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:189)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:157)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:114)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
... 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
Contact:

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.

Regards,
Markus (S)