Page 1 of 1

Resource is not public Failed to recompile instrumented code

Posted: Fri Nov 20, 2015 6:04 am
by Vijay
Hi,

My idea is to cleanup Keypass Mobile app before launching test. This can be done from Settings->Apps->Keypass "Clear Data". This means I should be able to steer Android Settings APk.

So I pulled settings apk using adb.

Now when instrumenting settings apk I get below error:

I understand this is related to google placed some restrictions on image resources for upgrade compatibility. Is there a workaround to instruments settings app.

System.Exception: Failed to recompile the instrumented code. See details for more information: C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\choose_lock_password.xml:8: error: Error: Resource is not public. (at 'keyBackground' with value '@android:drawable/btn_check_off_disable_focused_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout-land\choose_lock_password.xml:9: error: Error: Resource is not public. (at 'keyBackground' with value '@android:drawable/btn_check_off_disable_focused_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\choose_lock_pattern.xml:6: error: Error: Resource is not public. (at 'background' with value '@android:drawable/btn_group_normal_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout-land\choose_lock_pattern.xml:12: error: Error: Resource is not public. (at 'background' with value '@android:drawable/btn_group_normal_holo_dark').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\confirm_lock_pattern.xml:5: error: Error: Resource is not public. (at 'background' with value '@android:drawable/btn_group_normal_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\confirm_lock_pattern.xml:7: error: Error: Resource is not public. (at 'background' with value '@android:drawable/btn_group_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout-land\confirm_lock_pattern.xml:9: error: Error: Resource is not public. (at 'background' with value '@android:drawable/btn_group_normal_holo_dark').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\device_admin_add.xml:4: error: Error: Resource is not public. (at 'background' with value '@android:drawable/ic_dialog_alert_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\device_admin_settings.xml:4: error: Error: Resource is not public. (at 'background' with value '@android:drawable/ic_dialog_alert_holo_light').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\preference_dialog_brightness.xml:8: error: Error: Resource is not public. (at 'id' with value '@android:id/alwaysScroll').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\layout\preference_dialog_ringervolume.xml:8: error: Error: Resource is not public. (at 'id' with value '@android:id/alwaysScroll').

C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res\xml\dock_settings.xml:5: error: Error: Resource is not public. (at 'widgetLayout' with value '@android:layout/date_picker_material').

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [C:\Users\USER\AppData\Local\Temp\brut_util_Jar_1219446946346320363.tmp, p, --forced-package-id, 127, --min-sdk-version, 10, --target-sdk-version, 10, --version-code, 10, --version-name, 2.3.7, -F, C:\Users\USER\AppData\Local\Temp\APKTOOL9074997715739724850.tmp, -0, resources.arsc, -0, arsc, -I, C:\Users\user\apktool\framework\1.apk, -S, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res, -M, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:465)
at brut.androlib.Androlib.buildResources(Androlib.java:403)
at brut.androlib.Androlib.build(Androlib.java:291)
at brut.androlib.Androlib.build(Androlib.java:261)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [C:\Users\USER\AppData\Local\Temp\brut_util_Jar_1219446946346320363.tmp, p, --forced-package-id, 127, --min-sdk-version, 10, --target-sdk-version, 10, --version-code, 10, --version-name, 2.3.7, -F, C:\Users\USER\AppData\Local\Temp\APKTOOL9074997715739724850.tmp, -0, resources.arsc, -0, arsc, -I, C:\Users\user\apktool\framework\1.apk, -S, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res, -M, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:451)
... 5 more
Caused by: brut.common.BrutException: could not exec command: [C:\Users\USER\AppData\Local\Temp\brut_util_Jar_1219446946346320363.tmp, p, --forced-package-id, 127, --min-sdk-version, 10, --target-sdk-version, 10, --version-code, 10, --version-name, 2.3.7, -F, C:\Users\USER\AppData\Local\Temp\APKTOOL9074997715739724850.tmp, -0, resources.arsc, -0, arsc, -I, C:\Users\user\apktool\framework\1.apk, -S, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\res, -M, C:\Users\user\AppData\Local\RanorexStudio5\RxEnv\Android\temp\decomp\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:89)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
... 6 more

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, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
at Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)

Re: Resource is not public Failed to recompile instrumented code

Posted: Mon Nov 23, 2015 3:18 pm
by Support Team
Hi Vijay,

I’m afraid your plan is not achievable since it is not possible to instrument android system applications such as the settings app. In order to overcome this scenario, you could use the Android OS automation functionality as described in this chapter.
Hope that helps.

Regards,
Markus (S)