Instrumentation failed

Mobile Testing, Android App Testing.
alinurr
Posts: 2
Joined: Mon Jun 24, 2019 12:47 pm

Instrumentation failed

Post by alinurr » Mon Jun 24, 2019 2:06 pm

During deploying APK file, there were errors as:
Instrumentation failed...
The APK is not obfuscated.
You are using API level 8 or above.
No instrumented APK version is installed on the device.

Can you help, please. I tried methods that was written in this forum, they didn't help.

Details
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 Landroidx/appcompat/app/y;->a(Landroid/view/View;Ljava/lang/String;Landroid/content/Context;Landroid/util/AttributeSet;)Landroid/view/View;
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:917)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:341)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:297)
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:419)
at brut.androlib.Androlib.buildSources(Androlib.java:350)
at brut.androlib.Androlib.build(Androlib.java:302)
at brut.androlib.Androlib.build(Androlib.java:269)
at brut.apktool.Main.cmdBuild(Main.java:247)
at brut.apktool.Main.main(Main.java:79)
Caused by: org.jf.util.ExceptionWithContext: Error while writing instruction at code offset 0x6c
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1190)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:913)
... 10 more
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 66318
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:356)
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1150)
... 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, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
at Ranorex.Plugin.Mobile.RxIntegration.Instrumentation.AndroidWorker.Run()
at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)
Attachments
Снимок1.PNG
Снимок1.PNG (43.23 KiB) Viewed 250 times

User avatar
qwertzu
Posts: 275
Joined: Wed Jan 25, 2017 11:08 am

Re: Instrumentation failed

Post by qwertzu » Mon Jun 24, 2019 2:10 pm

Hi,

Try to use the instrumentaion flags mentioned in this post:
https://www.ranorex.com/forum/error-whi ... tml#p51707

regards, qwertzu

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

Re: Instrumentation failed

Post by odklizec » Mon Jun 24, 2019 2:21 pm

Hi,

If the instrumentation flags qwertzu suggested does not help, check also this post...
https://www.ranorex.com/forum/viewtopic ... 305#p55282
There is a known issue with Apktool, included in recent Ranorex 9.1, which may lead to instrumentation failure.
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

alinurr
Posts: 2
Joined: Mon Jun 24, 2019 12:47 pm

Re: Instrumentation failed

Post by alinurr » Tue Jun 25, 2019 6:04 am

Unfortunately none of the solutions helped me.

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

Re: Instrumentation failed

Post by odklizec » Tue Jun 25, 2019 8:04 am

Hi,

One more thing you should try is to increase the instrumentation timeout, as suggested here:
https://www.ranorex.com/forum/instrumen ... tml#p54425
Plus you should try previously mentioned instrumentation flags...
-static -multidex -smali_redist
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