Page 1 of 1

Instrumented Android APK failed (Error occurred)

Posted: Fri Nov 30, 2012 3:12 am
by sincoew
I instrumented our old version APK is success.
But when I instrumented our new version APK,
Ranorex instrumentation wizard popup error occurred.

Image

How do I fixed it?

Thanks.
Best Regards.
sincoew

Re: Instrumented Android APK failed (Error occurred)

Posted: Fri Nov 30, 2012 11:33 am
by Support Team
Hello,

Please make sure that you are using API level 8 or above. If the problem still existed we would need your APK.
Could you please send us your APK to [email protected] in order to fix this issue?

Regards,
Markus (T)

Re: Instrumented Android APK failed (Error occurred)

Posted: Fri Nov 30, 2012 12:13 pm
by sincoew
Hi Markus,

Thanks you for your reply,
I will check with our android team,
and I get error detail,
It's has any Information?

Best Regards,
Robert Chen.

--------------------------------Error Detail----------------------------

Code: Select all

System.Exception: Failed to recompile the instrumented code. See details for more information: I: Smaling...
I: Building resources...
..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\res\values-fr\strings.xml:44: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\res\values-fr\strings.xml:44: error: Unexpected end tag string
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Windows\TEMP\APKTOOL6663710222245321522.tmp, -I, ..\apktool\framework\1.apk, -S, ..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\res, -M, ..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\AndroidManifest.xml]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
	at brut.androlib.Androlib.buildResources(Androlib.java:248)
	at brut.androlib.Androlib.build(Androlib.java:171)
	at brut.androlib.Androlib.build(Androlib.java:154)
	at brut.apktool.Main.cmdBuild(Main.java:182)
	at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Windows\TEMP\APKTOOL6663710222245321522.tmp, -I, ..\apktool\framework\1.apk, -S, ..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\res, -M, ..\AppData\Roaming\RanorexStudio3\RxEnv\Android\temp\decomp\AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:83)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
	... 6 more

   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.ApkFileInstrumenter.CompileApkFile(String apkFilePath)
   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.BackgroundWorkerSupported.ExecuteBgwCode[TArg](BgwDelegate`1 methodDelegate, Int32 doneProgress, String progressText, TArg arg, BackgroundWorker bgw)
   at Ranorex.Plugin.Mobile.PlatformComponents.DeviceBridges.ApkFileInstrumenter.Instrument(String apkFilePath, String destinationFilePath, Int32 port, BackgroundWorker bgw)
   at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Re: Instrumented Android APK failed (Error occurred)

Posted: Fri Nov 30, 2012 2:14 pm
by Support Team
Hello,

It looks like the APK uses special characters (%) in its string resources. The compiler could have a problem with that. You could wait for the next Ranorex version (4.0.0 approx. in 2 weeks) or install the latest APKtool version.

APK-Tool:
Could you please update to the new APKTool and replace files in
'C:\program files\ranorexXX\bin\rxenv\Android\tools\apktool' and
'C:\users\%username%\AppData\Roaming\RanorexStudioXX\RxEnv\Android\tools\apktool.
Finally, you would need to instrument it.

Additional information about percent symbol can be found here.

Regards,
Markus (T)

Re: Instrumented Android APK failed (Error occurred)

Posted: Wed Dec 05, 2012 3:13 am
by sincoew
Hi Markus,

Thanks you for your help,
I update to the new APKTool and replace files also has error,
but I references your link http://stackoverflow.com/questions/4414 ... ent-symbol,
It's fix the problem.

Thanks a lot,
Best Regards,
Robert Chen

Re: Instrumented Android APK failed (Error occurred)

Posted: Wed Dec 05, 2012 11:11 am
by Support Team
Hello,

Your are welcome :-)
Thank you for your info.

Regards,
Markus (T)

Re: Instrumented Android APK failed (Error occurred)

Posted: Thu Dec 13, 2012 7:18 am
by sincoew
Hi Markus,

I update to ranorex 4.0,
but also can't Instrument android apk,
our apk has string such as

Code: Select all

<string formatted="false" name="select_playlist_add_success_toast">%d chanson(s) a/ont été ajoutée(s) à la playlist \"%s\".</string>
<string formatted="false" name="select_info_items_selected">%d albums sélectionnés\n%d éléments sélectionnés\nTotal %.2f Mo</string>
<string name="exit_toast">Sélectionnez Retour à nouveau pour quitter.</string>
I'm not sure which string has issue, ranorex 4.0 do not show error detail.
This error is in french language xml.

Although, I can delete a french language xml to fix this bug.
Can this bug will fix at the future? : )

Thanks you for your help.
Best Regards,
Robert Chen.

Re: Instrumented Android APK failed (Error occurred)

Posted: Thu Dec 13, 2012 4:42 pm
by Support Team
Hello,

Is it possible to get your APK file in order to analyze this issue.
You could send it to [email protected].

Regards,
Markus (T)

Re: Instrumented Android APK failed (Error occurred)

Posted: Tue Dec 18, 2012 2:22 pm
by Support Team
Hello,

Since APK-Tool is a 3rd-Party-Tool we could not provide a fix for this issue.
We have no influence how APK-Tool combile/decompile source code with our library.
As soon as there is a fix for APK-Tool Ranorex will support it as well.

In order to fix this issue you would have 3 options:
1) change resource strings in your xml file as you did it before
2) instrument APK manually as documented in section 'Instrumentation with Source Code' our User Guide
3) post an issue in APK-Tool forum to be fixed in later versions of APK-Tool

Regards,
Markus (T)