Instrumentation failed... Error deploying .apk

Mobile Testing, Android App Testing.
Tomek
Posts: 2
Joined: Tue Oct 25, 2016 2:08 pm

Instrumentation failed... Error deploying .apk

Post by Tomek » Wed Oct 26, 2016 2:33 pm

Hi,
I'm new to Ranorex and I had a problem recently trying to deploy .apk file to Android device.

Here are the screenshots from Ranorex Instrumentation Wizard:
Ranorex_instrumentation_Wizard_Error.png
Ranorex_instrumentation_Wizard_Error.png (46.28 KiB) Viewed 1004 times
Also screen with Android SDK Manager Info installed on my PC:
Android_SDK_Manager.png
Android_SDK_Manager.png (26.3 KiB) Viewed 1004 times
Detailed info concerning error:

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: 66637
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:400)
at brut.androlib.Androlib.buildSources(Androlib.java:331)
at brut.androlib.Androlib.build(Androlib.java:287)
at brut.androlib.Androlib.build(Androlib.java:263)
at brut.apktool.Main.cmdBuild(Main.java:224)
at brut.apktool.Main.main(Main.java:84)


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)

System info:

Ranorex version 6.1.1,
Ms Windows 7 64-bit,

Considering making sure of potential reasons of the problem which are mentioned on screen,
1. The APK is not obfuscated,
2. The API are using is 17 (Android 4.2.2)
3. No other version on APK is not installed on the device.

Please, help overcome this problem since we are about to decide whether or not moving to Ranorex for mobile automate testing.

Tomek

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Instrumentation failed... Error deploying .apk

Post by asdf » Thu Oct 27, 2016 3:17 pm

Hi Tomek,

Please try to set the instrumentation flag "-multidex" in the instrumentation wizard's settings.
Therefore, go to the instrumentation wizard and click on "Settings".
Ranorex Instrumentation Wizard.png
Ranorex Instrumentation Wizard.png (9.76 KiB) Viewed 989 times
Afterwards, add "-multidex" to the field "Instrumentation Flags".
Settings.png
Settings.png (11.18 KiB) Viewed 989 times
Hope this helps.

Kind regards,
asdf

Tomek
Posts: 2
Joined: Tue Oct 25, 2016 2:08 pm

Re: Instrumentation failed... Error deploying .apk

Post by Tomek » Fri Oct 28, 2016 10:05 am

Thanks asdf, it helps.:).
Although there was another problem with timeout's , but I overcome this with settings in Ranorex Recorder package.

Tomek