Instrumentation failed

Mobile Testing, Android App Testing.
isouza
Posts: 3
Joined: Thu Jun 13, 2019 8:59 pm

Instrumentation failed

Post by isouza » Thu Jun 13, 2019 9:10 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Instrumentation failed

Post by Support Team » Fri Jun 14, 2019 10:00 am

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

isouza
Posts: 3
Joined: Thu Jun 13, 2019 8:59 pm

Re: Instrumentation failed

Post by isouza » Fri Jun 14, 2019 3:00 pm

Thank you Stephan!

Solved my problem!

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Instrumentation failed

Post by Support Team » Mon Jun 17, 2019 8:49 am

I',m glad I could help.
You're welcome.

regards,
Stephan

dietowin
Posts: 2
Joined: Fri Aug 23, 2019 6:18 am

Re: Instrumentation failed

Post by dietowin » 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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Instrumentation failed

Post by Support Team » 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

dietowin
Posts: 2
Joined: Fri Aug 23, 2019 6:18 am

Re: Instrumentation failed

Post by dietowin » Mon Aug 26, 2019 5:36 am

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

Isla90
Posts: 1
Joined: Fri Aug 23, 2019 6:49 am

Re: Instrumentation failed

Post by Isla90 » Wed Sep 11, 2019 10:28 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Instrumentation failed

Post by Support Team » Thu Sep 12, 2019 7:59 pm

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
You do not have the required permissions to view the files attached to this post.

aboughosn
Posts: 2
Joined: Fri Sep 13, 2019 7:38 pm

Re: Instrumentation failed

Post by aboughosn » Fri Sep 13, 2019 7:49 pm

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)

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Instrumentation failed

Post by Support Team » Tue Sep 17, 2019 1:22 pm

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
You do not have the required permissions to view the files attached to this post.

aboughosn
Posts: 2
Joined: Fri Sep 13, 2019 7:38 pm

Re: Instrumentation failed

Post by aboughosn » Thu Sep 19, 2019 6:27 pm

-nores option worked.
I was already using version 9.1.2
Thanks!

oubar
Posts: 8
Joined: Wed May 08, 2019 2:15 pm

Re: Instrumentation failed

Post by oubar » Tue Sep 24, 2019 5:10 pm

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 ?

marcin1234
Posts: 2
Joined: Thu Apr 18, 2019 9:26 am

Re: Instrumentation failed

Post by marcin1234 » Wed Oct 09, 2019 1:27 pm

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