After I upgraded from Roku OS 7.7 to Roku OS 8.0 this error happened. I have two files included in MainScene.xml
<component name="MainScene" extends="Scene" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
<!-- importing main handler -->
<script type="text/brightscript" uri="pkg:/components/Album.brs" />
<script type="text/brightscript" uri="pkg:/components/Video.brs" />
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
</component>
Album.brs
function CreateAlbum()
return {
type: "album",
id: "",
isModified: false,
name: "",
description: "",
posterURL: "",
url: "",
uri: "",
videos: [],
totalVideos: 0,
addVideo: addVideo,
path: "" ' caching path on roku device
setId: setId,
setName: setName,
}
end function
function setId(id)
m.id = id
return m
end function
function setName(name)
m.name = name
return m
end function
function getId()
return m.id
end function
function getName()
return m.name
end function
Video.brs
function CreateVideo()
this = {
type: "video",
id: "",
name: "",
description: "",
duration: "",
posterURL: "",
url: "",
backgroundURL: "",
setId: setId,
setName: setName,
}
return this
end function
function setId(id)
m.id = id
return m
end function
function setName(name)
m.name = name
return m
end function
In Roku Os 7.7 I didn't face this problem. And now I have a compile error. Strange indeed.
------ Compiling dev 'Roku Scene Graph' ------
11-09 06:03:15.665 [scrpt.cmpl.time] Compiled 'Roku Scene Graph', id 'dev' in 1 milliseconds
11-09 06:03:15.668 [scrpt.load.mkup] Loading markup dev 'Roku Scene Graph'
=================================================================
Found 2 compile errors in file pkg:/components/Video.brs included from file pkg:/components/MainScene.xml
--- SUB or FUNCTION defined twice. (compile error &had) in pkg:/components/Video.brs(19) 'setid'
--- SUB or FUNCTION defined twice. (compile error &had) in pkg:/components/Video.brs(24) 'setname'
=================================================================
An error occurred while attempting to compile the application's components:
-------> Error parsing XML component MainScene
Please help me to find any workaround. I understand that I can include methods inside constructor function but I need to change so much. I have getters and setters outside constructor everywhere. Any help highly appreciated !