Cannot instrument apk with appcompat

Mobile Testing, Android App Testing.
mysanchez
Posts: 8
Joined: Mon Nov 04, 2013 7:40 am

Cannot instrument apk with appcompat

Post by mysanchez » Wed Nov 06, 2013 7:19 am

I have been trying to instrument one of the apks for recording but it instrumentation always fails. I keep getting this error:

Code: Select all

System.Exception: Failed to recompile the instrumented code. See details for more information: I: Smaling...
I: Building resources...
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:59: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:99: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:146: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:176: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:192: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:218: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:225: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:242: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:275: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values-v14\styles.xml:50: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res\values\styles.xml:467: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 8, --target-sdk-version, 18, -F, C:\Users\Miguel\AppData\Local\Temp\APKTOOL7441055142628040052.tmp, -0, arsc, -I, C:\Users\Miguel\apktool\framework\1.apk, -S, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res, -M, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\AndroidManifest.xml]
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
	at brut.androlib.Androlib.buildResources(Androlib.java:283)
	at brut.androlib.Androlib.build(Androlib.java:206)
	at brut.androlib.Androlib.build(Androlib.java:176)
	at brut.apktool.Main.cmdBuild(Main.java:228)
	at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 8, --target-sdk-version, 18, -F, C:\Users\Miguel\AppData\Local\Temp\APKTOOL7441055142628040052.tmp, -0, arsc, -I, C:\Users\Miguel\apktool\framework\1.apk, -S, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res, -M, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\AndroidManifest.xml]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:357)
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
	... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 8, --target-sdk-version, 18, -F, C:\Users\Miguel\AppData\Local\Temp\APKTOOL7441055142628040052.tmp, -0, arsc, -I, C:\Users\Miguel\apktool\framework\1.apk, -S, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\res, -M, C:\Users\Miguel\AppData\Local\RanorexStudio4\RxEnv\Android\temp\decomp\AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:89)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:355)
	... 6 more

   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.ApkFileInstrumenter.Instrument(String apkFilePath, Int32 port, BackgroundWorker bgw)
   at Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
   at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)


I've checked the api level and it is at least level 8, it is not obfuscated, and I've tried uninstalling the app in my S3 phone.

Also, I want to find out if there is way for ranorex to play actions that swipe down the notification drawer and press the wifi/gps/bluetooth buttons.

Thanks.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Cannot instrument apk with appcompat

Post by Support Team » Thu Nov 07, 2013 2:16 pm

Hi,

It looks like you use a third party library which is currently not supported by the auto-instrumentation wizard. Would it be possible to send or post us your APK file which you are trying to instrument?
Instead of using the automated instrumentation you can try to instrument your application manually. Therefore please take a look to following documentation http://www.ranorex.com/support/user-gui ... -code.html

Regards,
Peter
Ranorex Team
.
Image

mysanchez
Posts: 8
Joined: Mon Nov 04, 2013 7:40 am

Re: Cannot instrument apk with appcompat

Post by mysanchez » Thu Nov 14, 2013 8:01 am

Hi Peter,

I have tried making a test application using appcompat which it wasn't able to instrument as well. The code was a sample application from Android Developer Tools, with a single reference to the appcompat library. Also, since the library contains no source files but only resource files, I cannot manually instrument the app.

Thanks,
Miguel

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Cannot instrument apk with appcompat

Post by Support Team » Fri Nov 15, 2013 6:00 pm

Hi,
mysanchez wrote:The code was a sample application from Android Developer Tools, with a single reference to the appcompat library.
Please could you post me which application you've used. Then we can try it on one of our devices and give you feedback.

Thanks in advance.

Regrads,
Peter
Ranorex Team
.
Image

mysanchez
Posts: 8
Joined: Mon Nov 04, 2013 7:40 am

Re: Cannot instrument apk with appcompat

Post by mysanchez » Mon Nov 18, 2013 3:31 am

Please could you post me which application you've used
The sample application I was talking about was a new application with a blank Activity, with changes in the Android Manifest that had a single reference to Android's appcompat library. Aside from the auto generated starter code which ADT makes, there were no other changes, and the apk worked fine on my phone, but still could not be instrumented for testing in Ranorex

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Cannot instrument apk with appcompat

Post by Support Team » Tue Nov 19, 2013 3:42 pm

Hello mysanchez,

I have forwarded the issue to our development team, but in order to analyze the issue in more detail it would be very helpful to get your APK file if this is possible.
Please send the APK file to [email protected].
Thank you!

Regards,
Bernhard
.
Image