The mechanism to deploy your game differs between platforms. This article aims to articulate what is necessary to deploy to each platform that Libgdx officially supports.
Note: if using gradle you may prefer following the guidelines provided on this page.
Windows/Linux/Mac OS Xへ配布する
Windows/Linux/Macへ配布する最も簡単な方法は、
あなたが記述した全てのコード、libgdx と任意の拡張のコード、ゲーム素材を含んだ実行可能な JAR ファイルをEclipseで作成することです。
実行可能な JARファイルの作成方法は以下の通り:
The easiest way to deploy to Windows/Linux/Mac is to create a runnable JAR in Eclipse, which includes all of your code, the code of libgdx and any extensions, and your assets. To create a runnable JAR:
Right click your desktop project, select "Export"
In the next dialog, select "Java -> Runnable Jar", click "Next"
In the next dialog, specify the launch configuration you use to start the game on the desktop from within Eclipse, and select the output JAR file name
This will package all code and your assets into a single JAR file. To run the JAR file, a user can just double click it, provided she/he has Java installed.
packr is a tool to bundle a JRE with your desktop jar file in a cross platform manner. this tool is in development.
Deploying to Android takes some extra steps. This tutorial is done using Eclipse and the Android ADT plugin.
Right click your Android project and select "Export"
Select "Android -> Export Android Application"
Make sure the project you want to export is your project, select next
Select or create your keystore. If you are new to Android development, a keystore is used to sign your applications and is required for putting your application on the market. More information is available at: http://developer.android.com/tools/publishing/app-signing.html
Select your alias to sign with and enter the password. If you don't have an alias or want to create a new alias, select create new key and select next.
Now select the destination of where you want your app being exported to. This will export an .apk file in the selected directory capable of being uploaded to Google Play (formerly Android Market) and alternative app stores.
Select finish and your .apk will be built!
Notes
The .apk file can be used to install on devices directly such as via an email attachment or download. This requires the devices to have the 'Allow Unknown Sources' option enabled in settings. Some carriers unfortunately disable this setting.
LibGDX is only capable of officially exporting to devices running Android 2.2 or higher. If you are using LibGDX 0.9.9, you can export to Android 1.5+ Note that features supported by devices can vary, such as OpenGL ES 2 may not be supported on certain devices.
OpenGL ES 2 requires Android 2.2 or higher and a graphics card supporting it.
Features that are incompatible with the device such as trying to use immersive mode on a pre-kitkat device will simply not do anything on unsupported devices.
LibGDX supports x86 Android devices starting with 0.9.9 and up. Make sure the x86 folder with libraries is in your project. Gdx-setup-ui should now generate your project with these.
An OSX machine with Xcode installed (or the equivalent Hackintosh) and an Apple developer license account all established and paid for
Your app is configured in itunesconnect.apple.com with a version number that matches your ios/robovm.properties file
You have a matching distribution certificate set up at developer.apple.com per usual
On your build machine, open Xcode, go to Preferences -> Accounts, provide your login and choose View Details. Tap the "Recycle" button at bottom left. This will download all necessary certificates to a place that the RoboVM Eclipse plugin expects to find them. Click Done and exit Xcode.
Insert more here about tweaking the files: info.plist.xml, robovm.properties and robovm.xml.
Go into Eclipse, right click on your projectname-ios and choose RoboVM Tools -> Package for App-Store/Adhoc Distribution. In the resulting dialog, pick a directory where you wish the IPA and associated files to be placed, choose your signing identity (usually your company, not your machine's identifier), and the provisioning profile for this app (from developer.apple.com).
This will generate the projectname.IPA file. Now you are able to use the Application Loader to locate your IPA and submit it to iTunesConnect. It will appear under the Prerelease tab for your app, per usual. Then you can distribute to your TestFlight testers etc., per the usual Apple procedure.
Deploy to iOS
This section assumes you're familiar with the basic deployment steps for iOS apps.
Prerequisites:
An OSX machine with Xcode installed (or the equivalent Hackintosh) and an Apple developer license account all established and paid for
Your app is configured in itunesconnect.apple.com with a version number that matches your ios/robovm.properties file
You have a matching distribution certificate set up at developer.apple.com per usual
On your build machine, open Xcode, go to Preferences -> Accounts, provide your login and choose View Details. Tap the "Recycle" button at bottom left. This will download all necessary certificates to a place that the RoboVM Eclipse plugin expects to find them. Click Done and exit Xcode.
Insert more here about tweaking the files: info.plist.xml, robovm.properties and robovm.xml.
Go into Eclipse, right click on your projectname-ios and choose RoboVM Tools -> Package for App-Store/Adhoc Distribution. In the resulting dialog, pick a directory where you wish the IPA and associated files to be placed, choose your signing identity (usually your company, not your machine's identifier), and the provisioning profile for this app (from developer.apple.com).
This will generate the projectname.IPA file. Now you are able to use the Application Loader to locate your IPA and submit it to iTunesConnect. It will appear under the Prerelease tab for your app, per usual. Then you can distribute to your TestFlight testers etc., per the usual Apple procedure.
HTML/JSでの配布
HTML/JSでの配布は、たいていの場合とても簡単です。
HTML用 プロジェクトを右クリックして "Google -> GWT Compile"を選びます
既定の設定のままにして compileをクリックします
WAR ディレクトリの選択を求めるウィンドウが表示されます。WAR ディレクトリは HTML用 プロジェクトのフォルダ内にあります。
Deploying to HTML/JS is straightforward for most cases.
Right click your HTML project and select "Google -> GWT Compile"
Keep the default settings and click compile
A window will appear asking you to select the WAR directory. It is in your HTML project's folder.
GWT will proceed to cross-compile your code into javascript. It will take awhile, but you can view the progress by pulling up the console in Eclipse.
Once the compile is complete everything you need to run your game on the web will be inside the WAR directory. Unless you are using RPC calls or other server side operations in your game, there are only a few things left to do.
Copy the "index.html" file, your assets folder, and the folder ending in "mygdxgame.GWTDefinition" to a directory on your web server
Navigate to the URL and you should see a loading screen for your game
Notes:
If you are using server-side operations in your code, you will need to install Tomcat or similar software on your web server and place the full contents of your project's WAR directory in the "webapp" directory. More details here.