Instrumentation fails on Android device

Mobile Testing, Android App Testing.
Chris G
Posts: 1
Joined: Thu Nov 25, 2021 9:11 am

Instrumentation fails on Android device

Post by Chris G » Thu Nov 25, 2021 9:31 am

Hi,

I am currently trying to find out whether Ranorex would be a good addition for or company. I was trying to create some tests on an Android device, but the instrumentation failed unfortunately. I could not find any information regarding this specific topic in the documentation or in the forum. Maybe someone here can help me.

The instrumentation on the device always fails at 70% progress with following error (please see stacktrace below).

Ranorex version: 10.1.3
I made sure that the APK is not obfuscated.

Any help would be highly appreciated, thank you very much!


System.InvalidOperationException: Failed to recompile the instrumented code. See details for more information: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.jf.smali.smaliFlexLexer.newToken(smaliFlexLexer.java:3255)
at org.jf.smali.smaliFlexLexer.newToken(smaliFlexLexer.java:3276)
at org.jf.smali.smaliFlexLexer.yylex(smaliFlexLexer.java:3943)
at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:3198)
at org.antlr.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:143)
at org.antlr.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:137)
at org.antlr.runtime.CommonTokenStream.consume(CommonTokenStream.java:71)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:106)
at org.jf.smali.smaliParser.register_list(smaliParser.java:8306)
at org.jf.smali.smaliParser.insn_format35c_method(smaliParser.java:14612)
at org.jf.smali.smaliParser.instruction(smaliParser.java:11208)
at org.jf.smali.smaliParser.ordered_method_item(smaliParser.java:2195)
at org.jf.smali.smaliParser.statements_and_directives(smaliParser.java:1915)
at org.jf.smali.smaliParser.method(smaliParser.java:1711)
at org.jf.smali.smaliParser.smali_file(smaliParser.java:624)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:63)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:426)
at brut.androlib.Androlib.buildSources(Androlib.java:357)
at brut.androlib.Androlib.build(Androlib.java:309)
at brut.androlib.Androlib.build(Androlib.java:276)
at brut.apktool.Main.cmdBuild(Main.java:255)
at brut.apktool.Main.main(Main.java:81)

bei Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
bei Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
bei Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
bei Ranorex.Plugin.Mobile.RxIntegration.Instrumentation.AndroidWorker.Run()
bei Ranorex.Controls.Instrumentation.ViewModels.Pages.DeployingAndroidAppPageViewModel.<>c__DisplayClass45_0.<DoAutoAdjustedInstrumentationWork>b__0()

Jacob
Certified Professional
Certified Professional
Posts: 120
Joined: Mon Mar 22, 2021 10:01 pm

Re: Instrumentation fails on Android device

Post by Jacob » Fri Dec 03, 2021 5:31 pm

Hi Chris,

This error is from from the Java compiler (which recompiles the .apk file). Is it possible to free up or allocate any additional memory on the machine that is performing the instrumentation? From the contents of the error this seems the most likely culprit. If the instrumentation does fail at SMALI every time, it may be worth going into the advanced settings and configuring the SMALI option to the inverse of what is currently set.

--Jacob
Image