Error while intrumenting

Mobile Testing, Android App Testing.
wellingtonsantana
Certified Professional
Certified Professional
Posts: 18
Joined: Sat Jan 23, 2016 12:50 am
Contact:

Error while intrumenting

Post by wellingtonsantana » Wed Jun 08, 2016 3:13 am

Hello!
While I'm trying to instrument an .APK file, Ranorex returns an error like below and with this description.
Can you help me to fix this problem?

Code: Select all

System.Exception: Failed to recompile the instrumented code. See details for more information: Exception in thread "main" org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65564
	at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
	at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:329)
	at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1027)
	at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:803)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:252)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:230)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:57)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
	at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:385)
	at brut.androlib.Androlib.buildSources(Androlib.java:312)
	at brut.androlib.Androlib.build(Androlib.java:295)
	at brut.androlib.Androlib.build(Androlib.java:268)
	at brut.apktool.Main.cmdBuild(Main.java:225)
	at brut.apktool.Main.main(Main.java:84)


   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
   em Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)


   em Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
   em Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)
You do not have the required permissions to view the files attached to this post.

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 while intrumenting

Post by Support Team » Fri Jun 10, 2016 9:10 am

Hello wellingtonsantana,

May I ask which version of Ranorex are you using?
There is a possible workaround for this issue described in the forum post "deployment of apk with instrumentation raises Exception"

I hope this solves your problem.

Regards,
Bernhard

wellingtonsantana
Certified Professional
Certified Professional
Posts: 18
Joined: Sat Jan 23, 2016 12:50 am
Contact:

Re: Error while intrumenting

Post by wellingtonsantana » Mon Jul 04, 2016 8:38 pm

Hello guys!
My problemn persists :cry: .
I'm using Ranorex 6.0 with Windows 10, smartphone is Android 5.0.2.

Without the tags "-static -multidex", this error is displayed

Code: Select all

System.Exception: Failed to recompile the instrumented code. See details for more information: Exception in thread "main" org.jf.util.ExceptionWithContext: Unsigned short value out of range: 66057
	at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
	at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:329)
	at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1027)
	at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:803)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:252)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:230)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:53)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:38)
	at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:364)
	at brut.androlib.Androlib.buildSources(Androlib.java:295)
	at brut.androlib.Androlib.build(Androlib.java:278)
	at brut.androlib.Androlib.build(Androlib.java:254)
	at brut.apktool.Main.cmdBuild(Main.java:224)
	at brut.apktool.Main.main(Main.java:84)


   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
   em Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
   em Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
   em Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)
With the tags

Code: Select all

System.TimeoutException: Process did not finish within the specified timeout of '00:02:00'.
   em Ranorex.Core.ProcessRunner.RunShortProcess(Boolean showWindow, TimeSpan timeout, IList`1 appendToPath, String workingDir)
   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
   em Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
   em Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
   em Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
   em Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)

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 while intrumenting

Post by Support Team » Tue Jul 05, 2016 2:09 pm

Hello wellingtonsantana,

Unfortunately, the "-static -multidex" flag is necessary in order to overcome this type of error. When enabling this flag, Ranorex needs more time deploy the app to the device. Please try to increase the deploy timeout (e.g. to 5 minutes) and check if the issue still persists.

Regards,
Bernhard

wellingtonsantana
Certified Professional
Certified Professional
Posts: 18
Joined: Sat Jan 23, 2016 12:50 am
Contact:

Re: Error while intrumenting

Post by wellingtonsantana » Fri Aug 26, 2016 10:28 pm

Hello,
Just an update.
After install Ranorex 6.0.1, instrumentation is working fine.
Thanks all.