Search code examples
androidweex

Weex failed to render in Fragment


I am new to Weex and I need to render Weex in a Fragment in Android. But, it failed with the error:

Unexpected token '}'. Cannot parse statement.

I tried to search the clue like: ISSUE:How to load Weex into Fragment but I found no solution.

The output log is below:

08-13 12:16:36.306 20983-20983 E/JL: [ main: 
(WeexPageFragment.java:59) loadWeex ] - 
renderhttp://172.16.43.62:8080/dist/hello.js
08-13 12:16:36.306 20983-20983 D/WXSDKInstance: Start render page: 
08-13 12:16:36.308 20983-21003 D/weex: createInstance >>>> 
instanceId:1, options:{}, data:
callJS >>>> instanceId:1function:createInstance
08-13 12:16:36.342 20983-21003 D/jsLog: [JS Framework] COMPATIBILITY 
WARNING: Weex DSL 1.0 (.we) framework is no longer supported! It will 
be removed in the next version of WeexSDK, your page would be crash if 
you still using the ".we" framework. Please upgrade it to Vue.js or 
Rax.__ERROR
08-13 12:16:36.360 20983-21003 E/jsengine:  ReportException : 
Exception: SyntaxError: Unexpected token '}'. Cannot parse statement.
at (global function):8
Function@[native code]
Function@[native code]
(weex framework):1:148499
ei@(weex framework):1:148517
createInstance@(weex framework):1:151735
(weex framework):1:255299
08-13 12:16:36.360 20983-21003 E/weex: reportJSException >>>> 
instanceId:1, exception function:createInstance, exception:Exception: 
SyntaxError: Unexpected token '}'. Cannot parse statement.
at (global function):8
Function@[native code]
Function@[native code]
(weex framework):1:148499
ei@(weex framework):1:148517
createInstance@(weex framework):1:151735
(weex framework):1:255299

Solution

  • Finally i solved this problem(caused by called wrong method).

    And for those who need a demo to see How to render Weex page in Fragment try this weex-start-kit