Tuesday, May 30, 2017

Deploying libgdx to html

Leave a Comment

I tried deploying Libgdx to html using gradle. I copied the content

html/build/dist

and all I see in the browser is the badlogic image with a red background (what you would see if you just created a project) Why is that?

Using the superdev I can open it in the browser, i see where it says drag this button but can't play it. there's nothing

The code server is ready at http://127.0.0.1:9876/ GET /clean/html    Cleaning disk caches.       Cleaned in 29ms. GET /superdev.html    [WARN] ignored get request: /superdev.html    [WARN] not handled: /superdev.html > Building 91% > :html:superDev^C%    

enter image description here

turning the dev mod on I see Can't find any GWT Modules on this page.

If I build it normally, I see some warnings about depreciated methods, it builds successfully.

enter image description here

Assets aren't being loaded by html

1 Answers

Answers 1

I've few links that may be help you :

How to start Super Dev mode in GWT

Also check this thread https://stackoverflow.com/a/24265470/3445320

EDIT

I've tested on Android Studio with MacOS

Steps :

Run ./gradlew html:clean to clean your html module

  • On Android Studio Terminal I run ./gradlew html:superDev command
  • I got The code server is ready at http://127.0.0.1:9876/ on terminal
  • Then I open Google Chrome, View -> Always Show Bookmarks Bar
  • I typed http://127.0.0.1:9876/ in adress field -> enter
  • I got a page having Dev Mode On and Dev Mode Off, two buttons
  • Drag Dev Mode On to bookmarks bar, that is below my Address bar
  • Done! now I search http://localhost:8080/html/ , I got my game in browser
  • Press Dev Mode On button that is in bookmarks bar, I got option for compile

Now I need to deploy my html project

I run ./gradlew html:dist in Android Studio Terminal

I got BUILD SUCCESSFUL in Terminal then I find dist folder inside my html module.

dist folder is inside html module -> build -> dist

I copied dist folder and deployed to my server.

EDIT 2

Make sure badlogic.jpg is in your assets folder of android module

Check entry in assets.txt file and find badlogic.jpg inside html module->war->assets folder. If file or entry not exist.

Somehow program not able to write in assets folder

  • Check what programs have the file/s open
  • Check permissions and administrative rights
  • Delete the cache files, run "gradlew html:clean html:superDev" for every new run of superDev.
  • Check any anti-virus software, they can flag some of GWT's behaviour as suspicious
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment