[TIMOB-24191] Android: Unable to load asset from the resources directory in 6.0.0.GA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-12-05T16:00:27.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, regression |
Reporter | Joachim Mollin |
Assignee | Christopher Williams |
Created | 2016-12-02T13:33:19.000+0000 |
Updated | 2017-10-27T08:45:05.000+0000 |
Description
I use a web view to load a html file to present a graph. When loading the libraries I get an error in 6.0.0GA but not in 5.5.1GA.
[ERROR] : AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/Resources//ui/common/RGraph.common.core.js.lib
[ERROR] : AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/Resources//ui/common/RGraph.common.dynamic.js.lib
[ERROR] : AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/Resources//ui/common/RGraph.line.js.lib
<!DOCTYPE html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<!--Load the AJAX API-->
<script type="text/javascript" src="RGraph.common.core.js.lib" > </script>
<script type="text/javascript" src="RGraph.common.dynamic.js.lib" > </script>
<script type="text/javascript" src="RGraph.line.js.lib" > </script>
</head>
<body>
<!-- Content -->
</body>
</html>
[~cwilliams] Could this be caused by the require-changes in 6.0.0? If so, we could look into this for 6.0.1. Thx!
[~mollin] Can you upload the used JS files for us? Then I'll attach them to the ticket to have a 1:1 use-case. Thx!
I tried to reproduce the issue with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.0.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.0.0GA Appcelerator Studio, build: 4.8.0.201611121409 Xcode 8.1 GM I did not see the error with 5.5.1 GA, however, I was also not able to reproduce the error messages using 6.0.0 GA as reported in the ticket. Here is the code I used: app.js:
myLocalWebView.html:
Located in Resources folder: myLocalWebView.html RGraph.common.core.js.lib RGraph.common.dynamic.js.lib RGraph.line.js.lib The RGraph js files were downloaded from the RGraph website, and I added the .lib to the file names to match the names in the html file.
My lib files are locates in Resources/ui/common. It happens only for Android *HTML file*:
*Setup WebView*:
*If loaded, fire event*:
I'm also unable to reproduce this error. I don't think this is an SDK bug. If I look at the code you mention above:
It looks to me like on Android you're loading web view content at
<app>/Resources/ui/common/line_chart.html
. Given the JS script references are relative, that means that<app>/Resources/ui/common/line_chart.html
will load the JS files inside<app>/Resources/ui/common
fine; whereas<app>/Resources/line_chart.html
would expect them to live inside<app>/Resources/
Marking as invalid for now until we can see a reproducible case of this. QE and two SDK engineers were all unable to reproduce.
Hallo Chris, you might be right. But the example was working since 5.5.1GA. I didn’t change anything at that point. But it doesn’t work if i use the same url as for iOS. Please tell me what the correct url ist? Regards Joachim
HI, you are right. It works with /ui/common/line_chart.html. Thanks for your help. Then it must be a bug in older version as it works with 5.5.1GA
Closing ticket as invalid.
Hi guys, I have similar problem - I have webview.html in Resources folder and inside it I link webview.js via
it throws me error: AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/Resources//webview.js I'm using Ti.SDK 6.2.2GA on macOS Sierra and Nexus5x@Android 7.1 Can you please help me? Thanks
Hi guys, I found solution - problem was, that I created Ti.UI.webview from socket.js file which is required in app.js. I moved Ti.UI.webview to app.js and now it's working without that error.