Page 1 of 1

Instrumentation failed

Posted: Thu Jun 13, 2019 9:10 pm
by isouza
Hi all!

I'm using Ranorex 9.1, Windows 10 Pro and have the error bellow:

Instrumentation failed

Please make sure that:

- The APK is not obfuscated.
- You are using API level 8 or above
- No uninstrumented APK version is installed on the device.

I readed many topics like this here, but none solved my problem.
My APK is made in FireMonkey (Delphi Rio 10.3) and meets requirements above.

If i click in "Details", i receive the error bellow:

System.Exception: Failed to recompile the instrumented code.
See details for more information: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = -1073741515): [C:\Users\Ivan\AppData\Local\Temp\brut_util_Jar_674880722489268900.tmp, p, --forced-package-id, 127, --min-sdk-version, 19, --target-sdk-version, 28, --version-code, 10, --version-name, 1.0.10, --no-version-vectors, -F, C:\Users\Ivan\AppData\Local\Temp\APKTOOL715418112790319657.tmp, -0, arsc, -0, wav, -0, png, -0, arsc, -I, C:\Users\Ivan\AppData\Local\apktool\framework\1.apk, -S, C:\Users\Ivan\AppData\Local\RanorexStudio9\RxEnv\Android\temp\decomp\res, -M, C:\Users\Ivan\AppData\Local\RanorexStudio9\RxEnv\Android\temp\decomp\AndroidManifest.xml]

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, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
em Ranorex.Plugin.Mobile.RxIntegration.Instrumentation.AndroidWorker.Run()
em Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)


Anyone can help me?

Best regards,

Ivan

Re: Instrumentation failed

Posted: Fri Jun 14, 2019 10:00 am
by Support Team
Hello Isouza,

Thank you for your post.

This instrumentation error is most likely related to a bug in the apktool itself.
Ranorex uses the apktool to instrument Android apps.

Please try to perform the following steps and let us know if this resolves your problem:

1. Download the two files from the following link: https://upload.ranorex.com/s/BSPRJkX53qjax4Q
2. Rename the apktool_4.2.1.jar to "apktool.jar"
3. Replace the old apktool.jar from the following folder with the new one:
C:\Program Files (x86)\Ranorex <Ranorex Version>\Bin\RxEnv\Android\tools\apkTool
4. Delete the 1.apk file from the following directories (if available)
%userprofile%\apktool\framework
%localappdata%\apktool\framework
%temp%
5. Unzip the appt.zip file and copy the files to:
6. %temp%

I hope, these steps help and you're able to instrument your app afterwards.

Kind regards,
Stephan

Re: Instrumentation failed

Posted: Fri Jun 14, 2019 3:00 pm
by isouza
Thank you Stephan!

Solved my problem!

Re: Instrumentation failed

Posted: Mon Jun 17, 2019 8:49 am
by Support Team
I',m glad I could help.
You're welcome.

regards,
Stephan

Re: Instrumentation failed

Posted: Fri Aug 23, 2019 6:22 am
by dietowin
Hello everyone!
Could you please actualize the link? I have the same issue, but the file is not available now when following the link.

Re: Instrumentation failed

Posted: Fri Aug 23, 2019 3:26 pm
by Support Team
dietowin wrote:
Fri Aug 23, 2019 6:22 am
Hello everyone!
Could you please actualize the link? I have the same issue, but the file is not available now when following the link.
Hi dietowin,

Here you go: https://upload.ranorex.com/s/BSPRJkX53qjax4Q

I also updated the original post link. Note, this will be officially included in the next release of Ranorex (9.1.2 - ETA early September)

Cheers,
Ned

Re: Instrumentation failed

Posted: Mon Aug 26, 2019 5:36 am
by dietowin
Support Team wrote:
Fri Aug 23, 2019 3:26 pm
dietowin wrote:
Fri Aug 23, 2019 6:22 am
Hello everyone!
Could you please actualize the link? I have the same issue, but the file is not available now when following the link.
Hi dietowin,

Here you go: https://upload.ranorex.com/s/BSPRJkX53qjax4Q

I also updated the original post link. Note, this will be officially included in the next release of Ranorex (9.1.2 - ETA early September)

Cheers,
Ned
Thank you very much!

Best regards,
dietowin

Re: Instrumentation failed

Posted: Wed Sep 11, 2019 10:28 am
by Isla90
I have been facing the issue of auto instrumentation failed while integrating dynatrace. I have using multidex configuration application. can anyone provide the answer for me earliest. I have look into this issue for past one week.

Re: Instrumentation failed

Posted: Thu Sep 12, 2019 7:59 pm
by Support Team
Hello Isla90,

I would make sure you are using the -multdex flag when instrumenting, if the issue persists, please provide the exception details so that we may further investigate.
2019-09-12 14_55_41-Window.png
Regards,
Sean

Re: Instrumentation failed

Posted: Fri Sep 13, 2019 7:49 pm
by aboughosn
Hello,
I am a first time user trialing this software.
I am hitting a similar exception upon instrumentation of the APK.
I already tried the above suggestion (-multidex).
Any other ideas?

Below is the error stack:

System.InvalidOperationException: Failed to recompile the instrumented code. See details for more information: S: WARNING: Could not write to (C:\Users\aghosn\AppData\Local\apktool\framework), using C:\Users\aghosn\AppData\Local\Temp\ instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = -1073741515): [C:\Users\aghosn\AppData\Local\Temp\brut_util_Jar_7762335007843478658.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 27, --version-code, 1908200332, --version-name, 4.8.44.7, --no-version-vectors, -F, C:\Users\aghosn\AppData\Local\Temp\APKTOOL1552020771754950403.tmp, -0, arsc, -0, png, -0, res/drawable-hdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png, -0, ogg, -0, arsc, -I, C:\Users\aghosn\AppData\Local\Temp\1.apk, -S, C:\Users\aghosn\AppData\Local\RanorexStudio9\RxEnv\Android\temp\decomp\res, -M, C:\Users\aghosn\AppData\Local\RanorexStudio9\RxEnv\Android\temp\decomp\AndroidManifest.xml]

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)

Re: Instrumentation failed

Posted: Tue Sep 17, 2019 1:22 pm
by Support Team
Hello aboughosn,

This is most probably an issue that was fixed in Ranorex 9.1.2. Please install this version of Ranorex and add the instrumentation flag "-nores" and try to instrument the application again.
nores.png
This should solve the issue.

Regards,
Bernhard

Re: Instrumentation failed

Posted: Thu Sep 19, 2019 6:27 pm
by aboughosn
-nores option worked.
I was already using version 9.1.2
Thanks!

Re: Instrumentation failed

Posted: Tue Sep 24, 2019 5:10 pm
by oubar
Hello all,

I have another kind of failure

i'm using version 9.1.2.

I tried instrumentation by using this flag : -static -multidex -nores -smali_redist

I have this errors :
System.NotSupportedException: AndroidManifest.xml is of unsupported/unrecognized file format. Expected file formats are pure human readable xml or Android xml binary format.
à Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.AndroidManifest.ReadAndroidManifest(String fileName)
à Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.ProcessManifest(String manifestPath, DecompileInfo& dcInfo, InstrumentApkOptions instrumentOptions)
à Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.DecompileApkFile(String apkFilePath, Boolean showProcessWindows, IPathService pathService, InstrumentApkOptions deployOptions)
à Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
à Ranorex.Plugin.Mobile.RxIntegration.Instrumentation.AndroidWorker.Run()
à Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)

Any idea ?

Re: Instrumentation failed

Posted: Wed Oct 09, 2019 1:27 pm
by marcin1234
Hi,

If this kind of exception there is, then check one more time, however without -nores option.
If the problem will still exist then provide the application, if possible.

Kind regards,
Marcin