Error while instrumenting and deploying app

Mobile Testing, Android App Testing.
zjemCiChleb
Posts: 3
Joined: Mon Jan 19, 2015 3:03 pm

Error while instrumenting and deploying app

Post by zjemCiChleb » Mon Jan 19, 2015 3:12 pm

Hi, I have a problem with instrumenting and deploying my app at android device.
Old version instrumented and deployed just fine, but the new one one reports error message.

I attach error details :

System.Exception: Failed to decompile the APK file. See details for more information: W: Could not decode attr value, using undecoded value instead: ns=android, name=touchscreenBlocksFocus, value=0xffffffff
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 0x0101048f
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:59)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:36)
at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlResourceParser.java:369)
at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(XmlPullParserDelegate.java:69)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:83)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:141)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:33)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:107)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:91)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:322)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:123)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:102)
at brut.apktool.Main.cmdDecode(Main.java:170)
at brut.apktool.Main.main(Main.java:86)
Picked up _JAVA_OPTIONS: -Xmx256m -Xms256m

at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.DecompileApkFile(String apkFilePath, Boolean showProcessWindows, IPathService pathService, InstrumentApkOptions deployOptions)
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)

Do you have any idea what might have caused the problem ?
I would be grateful for your replies.
You do not have the required permissions to view the files attached to this post.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Error while instrumenting and deploying app

Post by krstcs » Mon Jan 19, 2015 3:29 pm

First, please provide the following information in the post when you have questions:

1. Ranorex version (5.2.2 is current).
2. Windows version
3. .NET versions (both runtime and SDK) installed.



Second, did you check that you weren't violating any of the issues that the error message listed?

Is the APK obfuscated?
Are you using API level 8 or higher?
Is there an uninstrumented version of this APK already installed on the device?
Shortcuts usually aren't...

zjemCiChleb
Posts: 3
Joined: Mon Jan 19, 2015 3:03 pm

Re: Error while instrumenting and deploying app

Post by zjemCiChleb » Mon Jan 19, 2015 3:59 pm

Operating system is Windows 7 enterprise,
as for SDK version and Ranorex version i attach screens.
You do not have the required permissions to view the files attached to this post.

zjemCiChleb
Posts: 3
Joined: Mon Jan 19, 2015 3:03 pm

Re: Error while instrumenting and deploying app

Post by zjemCiChleb » Mon Jan 19, 2015 4:20 pm

And as for questions about API, other instrumented version and obfuscated APK - everything is as it should be:

I'm trying to run the tests on Nexus 9 - it's android 5.0 so API version is definitely ok, After few failures I've cleared all the tablet's memory so there is no uninstrumented versions off the app - no doubt. Code is similar to the one in older version and that worked fine.

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

Re: Error while instrumenting and deploying app

Post by Support Team » Wed Jan 21, 2015 12:48 pm

Hello zjemCiChleb,

May I ask you to send your APK file or even the Android project to [email protected]. This would help us in analyzing your issue in more detail.

Thank you in advance.

Regards,
Robert

Ulrik
Posts: 1
Joined: Tue Feb 10, 2015 11:27 am

Re: Error while instrumenting and deploying app

Post by Ulrik » Tue Feb 10, 2015 11:37 am

This error is due to an out-of-date version of apktool. The apktool 2.0.0-RC3 supports Lollipop - previous versions do not. So you must replace the apktool.jar inside the ..\RxEnv\Android\tools\apktool\ with the RC3 version (or newer). Also, you must delete the framework 1.apk inside \Users\<user>\apktool. When decompiling an apk next time, the latest 1.apk packaged inside the apktool.jar will be copied there.

Apktool downloads:
https://code.google.com/p/android-apktool/

NOTE:
This is a workaround. The "proper" solution would be to wait on a new Ranorex update, including the updated apktool.

NEW BUG:
When using the above approach (using apktool 2.0.0-RC3), the apk can be decompiled without problems. But I get a another Ranorex-internal error:

System.NullReferenceException: Object reference not set to an instance of an object.
at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.ResolveInheritanceDependencies(DecompileInfo dcInfo, IPathService pathService)
at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.InstrumentCode(DecompileInfo dcInfo, Int32 port, IPathService pathService)
at Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1,TArg2](BgwDelegate`3 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, TArg2 arg2, 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)

Can you assist?

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Error while instrumenting and deploying app

Post by krstcs » Tue Feb 10, 2015 2:49 pm

Please do not add new issues to existing threads. If you have a new issue please create a new forum thread so it isn't overlooked and no one gets confused about which problem is being discussed.

If it is related, then add a reference link to the original thread.


As far as updating the apktool.jar, I would suggest not doing it unless Ranorex has specifically told you to. Ranorex cannot support out-of-band changes like that and it can cause other issues that could compound the problem.
Shortcuts usually aren't...

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

Re: Error while instrumenting and deploying app

Post by Support Team » Wed Feb 11, 2015 12:02 pm

Hi Ulrik,

krstcs is right, adding a new or other issue to an existing thread is not a good idea and is confusing for our users.
Is it also true that installing the new apktool is not always a good idea.

Anyway, have you also renamed the downloaded APK tool to "apktool.jar"?
If so, could you send me your apk file, to [email protected]?
This will help me in analyzing the issue.

Thanks,
Markus