Avi
Avi

Reputation: 91

Worklight app crashes with error android.content.res.Resources$NotFoundException

my worklight hybrid app has started to crash with the below error. The code that triggers this is a window.open() function call. On click of a button I am supposed to open a url within InAppBrowser. I have seen this working last week but not it does not.

I have tried everything from revert to old code, to change the way the function is called. Nothing has worked.

Did some search online based on logs, looks like few people had similar problem due to missing resource files (.png). In my case I am unable to find which resource is missing, the log does not mention anything. Can someone help find some information from these

logcat lines....

08-25 15:03:17.111: W/PluginManager(540): THREAD WARNING: exec() call to NetworkDetector.getNetworkInfo blocked the main thread for 23ms. Plugin should use CordovaInterface.getThreadPool().
08-25 15:03:18.001: D/InAppBrowser(540): target = _blank
08-25 15:03:18.001: D/InAppBrowser(540): in blank
08-25 15:03:18.011: W/ResourceType(540): No package identifier when getting value for resource number 0x00000000
08-25 15:03:18.011: W/System.err(540): android.content.res.Resources$NotFoundException: Resource ID #0x0
08-25 15:03:18.011: W/System.err(540):  at android.content.res.Resources.getValue(Resources.java:1019)
08-25 15:03:18.021: W/System.err(540):  at android.content.res.Resources.getDrawable(Resources.java:663)
08-25 15:03:18.021: W/System.err(540):  at org.apache.cordova.inappbrowser.InAppBrowser$5.run(InAppBrowser.java:500)
08-25 15:03:18.030: W/System.err(540):  at android.app.Activity.runOnUiThread(Activity.java:4170)
08-25 15:03:18.030: W/System.err(540):  at org.apache.cordova.inappbrowser.InAppBrowser.showWebPage(InAppBrowser.java:654)
08-25 15:03:18.041: W/System.err(540):  at org.apache.cordova.inappbrowser.InAppBrowser$1.run(InAppBrowser.java:149)
08-25 15:03:18.041: W/System.err(540):  at android.app.Activity.runOnUiThread(Activity.java:4170)
08-25 15:03:18.051: W/System.err(540):  at org.apache.cordova.inappbrowser.InAppBrowser.execute(InAppBrowser.java:113)
08-25 15:03:18.051: W/System.err(540):  at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:84)
08-25 15:03:18.061: W/System.err(540):  at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
08-25 15:03:18.061: W/System.err(540):  at org.apache.cordova.PluginManager.execHelper(PluginManager.java:242)
08-25 15:03:18.061: W/System.err(540):  at org.apache.cordova.PluginManager.exec(PluginManager.java:227)
08-25 15:03:18.071: W/System.err(540):  at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
08-25 15:03:18.071: W/System.err(540):  at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:229)
08-25 15:03:18.071: W/System.err(540):  at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:600)
08-25 15:03:18.081: W/System.err(540):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-25 15:03:18.091: W/System.err(540):  at android.os.Looper.loop(Looper.java:137)
08-25 15:03:18.091: W/System.err(540):  at android.app.ActivityThread.main(ActivityThread.java:4340)
08-25 15:03:18.103: W/System.err(540):  at java.lang.reflect.Method.invokeNative(Native Method)
08-25 15:03:18.103: W/System.err(540):  at java.lang.reflect.Method.invoke(Method.java:511)
08-25 15:03:18.111: W/System.err(540):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-25 15:03:18.111: W/System.err(540):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-25 15:03:18.111: W/System.err(540):  at dalvik.system.NativeStart.main(Native Method)

Upvotes: 1

Views: 915

Answers (3)

vinesh
vinesh

Reputation: 4903

I had similar issue. Try re-installing the inappbrowser plugin. This solved my issue and now no more app crashed while opening inappbrowser.

Upvotes: 1

asselin
asselin

Reputation: 1913

The APAR that Idan references says that there are several .pngs missing from the Worklight project. After applying the iFix, Worklight will NOT add those .pngs into your project. You need to copy them from another project into your existing project. For reference, what's missing are the following files from the android/native/res/drawable-[hdpi|xhdpi|xxhdpi|mdpi] folders:

ic_action_next_item.png
ic_action_previous_item.png
ic_action_remove.png

Upvotes: 2

Idan Adar
Idan Adar

Reputation: 44516

What is the build number of your Worklight Studio installation?
You can check this in Eclipse > Help > About > Worklight.

This issue was recently fixed in the August 18th iFix, now available. Make sure to update your Worklight Studio plug-in in Eclipse > Help > Check for updates...

For reference: PI21653: USING WINDOW.OPEN TO OPEN THE INAPPBROWSER RESULTS IN AN EXCEPTION AND A CRASH IN THE APP ON ANDROID.

Upvotes: 0

Related Questions