Thanks for update.
Joshua,
I am experiencing widget problems as well but in connection with widget.newButton (see here, things are really slow on Android). You explained a workaround however I am requiring widget.lua in my main.lua only once at startup and not multiple times thereafter. So this workaround will not help me - is there any other temporary fix to this? Otherwise I will not be able to build and release my game for Android.
Thanks,
Jens
Poke … Joshua … can you respond please … this bug is not helping our cause much.
Thanks!
m
I also tried the suggested WA with unique “widget” library requirement in the main, and Android still has the same very slow performance for widget 2.0 elements.
When this issue is planned to be fixed? Thanks
@mslack how can you see the logs on Android device for Corona application? I mean:
V/Corona (16077): Loading plugins: widgetLibrary.widget_tableview.LuaLoader
V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget_tableview.
Thanks
using the android debugging tools the following into the command line gets the console output:
./adb logcat Corona:v *:s
So i am running out of time on this issue and need to look at your suggested work-around
I it tried to go to the bitbucket reference you posted above and it says i do not have access to that repository.
Can you answer two questions:
-
What is the proper location of the widget files
-
exactly how do i use them? (put them in my root directory with the name “widget” and they will take precidence?)
Thanks a bunch
m
Oh I’m sorry. I pointed you to the wrong online repository. You can find our widget source code here…
https://github.com/coronalabs/framework-widgets
All widget Lua files are expected to be in a subdirectory named “widgetLibrary”. The above repository has a “widgetLibrary” folder containing all of the widget Lua scripts. That subfolder is the only you thing you need to work-around this problem, because all of the other widget files are already embedded in every Corona built app.
That said, we plan to finish testing our newest widget changes today. If all goes well, this fix will be made available in tomorrow’s daily build, if you’re willing to wait for it.
seems to work! Thanks for getting this one sorted out.
Joshua, this is great news! There were numerous daily builds yesterday so I’m a little confused with whats where. Can you kindly respond to this thread and confirm which build # includes this fix when its out? Thank you so much!
Everyone,
This issue is fixed in daily build #1126, which was just made available today.
Also, it would be great if you can let us know if this build solves this issue for you.
One more thing. We’ve made a breaking change with how you can override our widget library with your own implementation or with what is on GitHub. Our widget library will no longer look for your Lua files under the “widgetLibrary” subdirectory by default. This is because that file lookup for a file that is not there was responsible for this performance hit. But that said, we’ve came up with an even better solution that allows you to put your widget Lua files anywhere that you want to override Corona’s core widget implementation. You can do so in your “main.lua” as follows…
-- Override Corona's core widget libraries with the files contained in this project's subdirectory. -- Argument "name" will be set to the name of the library being loaded by the require() function. local function onRequireWidgetLibrary(name) return require("widgetLibrary." .. name) end package.preload.widget = onRequireWidgetLibrary package.preload.widget\_button = onRequireWidgetLibrary package.preload.widget\_momentumScrolling = onRequireWidgetLibrary package.preload.widget\_pickerWheel = onRequireWidgetLibrary package.preload.widget\_progressView = onRequireWidgetLibrary package.preload.widget\_scrollview = onRequireWidgetLibrary package.preload.widget\_searchField = onRequireWidgetLibrary package.preload.widget\_segmentedControl = onRequireWidgetLibrary package.preload.widget\_spinner = onRequireWidgetLibrary package.preload.widget\_stepper = onRequireWidgetLibrary package.preload.widget\_switch = onRequireWidgetLibrary package.preload.widget\_tabbar = onRequireWidgetLibrary package.preload.widget\_tableview = onRequireWidgetLibrary
The above code affectively overrides Lua’s require() function for the above Lua libraries and calls the onRequireWidgetLibrary() instead. That’s your opportunity to load your own widget Lua file from any directory that you want. So, when you do the following in Lua…
local widget = require(“widget”)
The above code will override that require call and load the “widgetLibrary/widget.lua” file instead of Corona’s core implementation. In any case, I hope this makes sense.
Any word on this bug? This is a show stopper and with a delivery deadline looming it would certainly be helpful for this one to find a resolution.
Cheers!
m
+1
A quick fix to this would be really helpful - I can’t publish for Android as long as this has not been sorted out. Thank you!
Jens
@Joshua thanks for update about Android issue fix.
I didn’t understood your post about “package.preload.widget = …”. I have two questions:
-
Should we still write in the code ‘local widget = require(“widget”)’ or it is performed automatically from Corona’s core?
-
If I want to change the button widget implementation, what steps should I do? As I understand, I should:
a) to take a widget_button.lua file from this link: https://github.com/coronalabs/framework-widgets
b ) to change it
c) to save in my project folder somewhere (if it is, then where to save?)
d) to write the follow code in my main.lua:
local function onRequireWidgetLibrary(name)
return require(“widgetLibrary.” … name)
end
package.preload.widget_button = onRequireWidgetLibrary
I guess I didn’t understood correctly the steps. Could you please explain it in a more detail way?
>> Should we still write in the code ‘local widget = require(“widget”)’ or it is performed automatically from Corona’s core?
Yes, this is the correct way of requiring in the “widget” library. That aspect hasn’t changed. By default, this will require in Corona’s core implementation unless you have a “widget.lua” file in your project’s root directory.
>> If I want to change the button widget implementation, what steps should I do?
This is what you should do:
-
Download our “widget_button.lua” file from our GitHub repository.
-
Copy the “widget_button.lua” file to your project’s root directory.
-
Modify that Lua file to whatever you want it to do.
That’s it. When you call the widget.newButton(), Corona will check if you have a “widget_button.lua” file in your root directory first before using its core implementation. You only need to use the “package.preload” method I posted up above if you want to place your “widget_button.lua” in a subdirectory… or load a Lua file with a different name.
I am seeing exactly the same behavior on Android only with the same error messages in the logs.
Any news from Corona Labs on this issue? Stopping the show for Android this one is.
I just tried the lastest build, 1107, and it seems to be behaving better. Give it a try and let me know if it seems better for you or if it’s just wishful thinking on my part.