Cannot instrument .apk - Error displays

Mobile Testing, Android App Testing.
grekha
Posts: 3
Joined: Fri Jun 12, 2020 1:10 am

Cannot instrument .apk - Error displays

Post by grekha » Thu Jun 18, 2020 4:16 am

I am facing instrumentation error I have tried all ways forum suggested adding -multidex -nores -smali redist but no luck .This process is show stopper for testing further .Can someone please help me instrumenting apk file. Thank you !

I’m using ranaorex 7.1 version ,ranorex 2.0.1
Android version is 8.10

Also please suggest any settings i have to do.

Here is the Log error as below...

System.Exception: Failed to recompile the instrumented code. See details for more information: Exception in thread "main" org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Landroid/support/v4/util/LongSparseArray;->clone()Landroid/support/v4/util/LongSparseArray;

at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:824)

at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:267)

at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:245)

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:423)

at brut.androlib.Androlib.buildSources(Androlib.java:354)

at brut.androlib.Androlib.build(Androlib.java:310)

at brut.androlib.Androlib.build(Androlib.java:267)

at brut.apktool.Main.cmdBuild(Main.java:230)

at brut.apktool.Main.main(Main.java:83)

Caused by: org.jf.util.ExceptionWithContext: Error while writing instruction at code offset 0x13

at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1091)

at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:820)

... 10 more

Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65554

at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)

at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:348)

at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1051)

... 11 more





at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)

at Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)

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)

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

Re: Cannot instrument .apk - Error displays

Post by odklizec » Thu Jun 18, 2020 8:03 am

Hi,

I'm afraid, Ranorex 7.1 is way too old, obsolete and no longer supported. The obvious thing you should try, is to update Ranorex with most recent 9.3.2 and try it again (even in trial mode). If 9.3.2 is able to instrument your app, you have your answer. If you cannot update to most recent Ranorex version, your only hope is to search old posts, regarding instrumentation of Android apps, and try all the suggestions you may eventually find.
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