Error while deploying apk file

Mobile Testing, Android App Testing.
Punashri M S
Posts: 42
Joined: Tue Jan 30, 2018 12:56 pm

Error while deploying apk file

Post by Punashri M S » Mon Dec 03, 2018 5:55 am

Hello All,

Am facing a issue while deploying the apk file.

Find the attached file for error message.
Error.png (116.98 KiB) Viewed 862 times
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 Lcom/google/android/gms/internal/clearcut/zzfx;->zzeq()Lcom/google/android/gms/internal/clearcut/zzfx;
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(
at org.jf.dexlib2.writer.DexWriter.writeTo(
at org.jf.dexlib2.writer.DexWriter.writeTo(
at brut.androlib.Androlib.buildSourcesSmali(
at brut.androlib.Androlib.buildNonDefaultSources(
at brut.apktool.Main.cmdBuild(
at brut.apktool.Main.main(
Caused by: org.jf.util.ExceptionWithContext: Error while writing instruction at code offset 0x69
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(
... 10 more
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65570
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(
at org.jf.dexlib2.writer.InstructionWriter.write(
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(
... 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)

Please help me with the solution.

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

Re: Error while deploying apk file

Post by odklizec » Mon Dec 03, 2018 9:10 am


Unfortunately, there is not enough information regarding your issue. What Ranorex version do you use? If something older than most recent 8.3.1, then please update it first and try to rebuild your app again.

Also, check this post with apktool flags, which may eventually help you...
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

Punashri M S
Posts: 42
Joined: Tue Jan 30, 2018 12:56 pm

Re: Error while deploying apk file

Post by Punashri M S » Mon Dec 03, 2018 11:55 am

Thanks for the response.

Using 8.3 Ranorex version.

changed the instrumentation flag from -ststic to -multidex and also downgrade to an older version of the apk tool and tried but no use.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12167
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Error while deploying apk file

Post by Support Team » Mon Dec 03, 2018 12:21 pm

Hello Punashri,

Thank you for your posts.

Please try to use the flags -static and -multidex for instrumenting your app.

static_multidex.png (12.66 KiB) Viewed 845 times

If the error still appears, may I ask you to create a new support ticket and attach the *.apk file?
This would help us to further analyze your issue.

Thank you in advance.