Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Pages: 1 2 [All]

Author Topic: Convert game by windows to android  (Read 8091 times)

0 Members and 1 Guest are viewing this topic.

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Convert game by windows to android
« on: August 11, 2013, 05:12:50 PM »

Hello guys,

i tried demo.apk and worked fine.

I have little question. My wish is: convert my completed game on windows to android.

It is possible? Please can you give me steps for this?

I finded manual on wiki. But i have problem with point where i must copied dcp on folder assets => I do not have this folder.

Quote
Building a game package from precompiled libraries

    Note: Before starting, make sure you are capable of building an Android app using one of the examples from the Android SDK.
    If not already done, install the SDK platform for Android 2.3.3 (API 10).
    Obtain sources from Mercurial repository: https://bitbucket.org/MnemonicWME/wmelite
    Download dependencies for Android (dep_android_*.zip): https://bitbucket.org/MnemonicWME/wmelite/downloads
    Unpack dependencies into the wmelite/android folder.
    Place your game files into the wmelite/android/assets/raw folder and rename them from ".dcp" to ".png". If you are going to distribute your game via the Google Play store, your game must not be bigger than 50 MB in total.
    Change the package and class name of org/example/yourapppackagename/YourGameName.java located at wmelite/android/src/ into something meaningful for your game.
    You need to change the AndroidManifest.xml as well, which is located at wmelite/android/, to reflect your changes. Edit package="org.libsdl.app" and android:name="SDLActivity" to match your changes.
    Edit res/values/strings.xml located at wmelite/android/ to fill in the name of your app.
    Modify the game package and file path to point at the asset directory. Edit org/deadcode/wmelite/WMELiteFunctions.java located at wmelite/android/ and change the return values of the getGamePackagePath() and getGameFilePath() from "/mnt/sdcard" to "asset://raw".
    If you use bitmap fonts with a different locale than "US-ASCII", fill in the proper locale in the functions getEncodedString() and getUTFString().
    Build the Android app.



BR


pirko7
« Last Edit: August 12, 2013, 05:04:03 PM by pirko7 »
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #1 on: August 13, 2013, 07:44:58 AM »

Hi,

you can simply go ahead and create the missing folders. They are not present in  the repository (yet) because I did not want to check in empty folders. As soon as you create them and place your files there, the Android tools will pick it up when you build the app.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #2 on: August 13, 2013, 08:06:49 PM »

Many Thanks  :), i wanted to do. I finished all steps.. but... I need a little help with export to .APK with files. Android SDK i have ready, i used it when i hack my android phone. Eclipse too.
Please i need help with next steps.

BR

Roman
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #3 on: August 16, 2013, 09:26:11 AM »

To get to a .apk file with debug signing key, just let the android command line tools help you (unless you're using eclipse where everything is already done for you).

In the root of your project please type

Code: [Select]
android update project --path .

(not 100% sure about the syntax, but I think you get the idea). This will create a "local.properties" and a "build.xml" upon success. Then try to run

Code: [Select]
ant debug

and see whether a debug .apk is created. If not, please post the error (plus a list of files from the directory where you typed "android" resp. "ant").
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #4 on: August 16, 2013, 11:07:29 PM »

Thank you for help. But i have problem with command line tools. I can not find it  :(. I still seeking instructions on google.
Please, can you give me more information about this step?

BR

Roman
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #5 on: August 17, 2013, 08:33:48 AM »

When you have the SDK installed onto your machine, it is installed in one directory which you specified (or accepted the default one). So let's assume that is c:\android-sdk\

Inside that directory, you have one directory called "tools", where the "android[.exe]" is to be found. To use this tool from the command line, either put it in your PATH variable or call it with the full path, i.e. "C:\android-sdk\tools\android.exe".

If you haven't already done, install the dependencies for Android 2.3.3 (API 10). Call the "android[.exe]" without any arguments. A GUI should appear. Select "Android 2.3.3 (API 10)" --> "SDK Platform". Other platforms you can de-select (shorter download). Do not change anything for "Tools" and "Extras". Download & then exit the GUI.

You should now be able to proceed using the "android[.exe]" for the next steps detailed in the previous posts.

If something doesn't work as expected, please double-check the "System Requirements" from here http://developer.android.com/sdk/index.html especially the part about the Java 6 JDK (not JRE) and Apache Ant.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #6 on: August 17, 2013, 09:36:36 AM »

Thank you for your answer.

I have SDK ready.
But i have not file android.EXE.

 

And this is folder tools:

 

Is there only android.bat and this start SDK manager.
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #7 on: August 17, 2013, 09:39:26 AM »

Ok I didn't know its a batch file on Windows. So please try using "android.bat". If it doesn't work, can you please dump the content of the batch file here?
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #8 on: August 17, 2013, 10:44:14 AM »

Batch file started only SDK manager.

Here is code from android.bat

Code: [Select]
@echo off
rem Copyright (C) 2007 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem Useful links:
rem Command-line reference:
rem   http://technet.microsoft.com/en-us/library/bb490890.aspx

rem don't modify the caller's environment
setlocal

rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0

rem Grab current directory before we change it
set work_dir="%cd%"

rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0


rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF

set jar_path=lib\sdkmanager.jar;lib\swtmenubar.jar

rem Set SWT.Jar path based on current architecture (x86 or x86_64)
for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a

:MkTempCopy
    rem Copy android.bat and its required libs to a temp dir.
    rem This avoids locking the tool dir in case the user is trying to update it.

    set tmp_dir=%TEMP%\temp-android-tool
    xcopy %swt_path% %tmp_dir%\%swt_path% /I /E /C /G /R /Y /Q > nul
    copy /B /D /Y lib\common.jar         %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\commons-codec*     %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\commons-compress*  %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\commons-logging*   %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\dvlib.jar          %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\guava*             %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\httpclient*        %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\httpcore*          %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\httpmime*          %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\layoutlib-api.jar  %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\org-eclipse-*      %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\sdk*               %tmp_dir%\lib\        > nul
    copy /B /D /Y lib\swtmenubar.jar     %tmp_dir%\lib\        > nul

    rem jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.
    set tools_dir=%cd%
    cd /d %tmp_dir%

:EndTempCopy

rem The global ANDROID_SWT always override the SWT.Jar path
if defined ANDROID_SWT set swt_path=%ANDROID_SWT%

if exist %swt_path% goto SetPath
    echo ERROR: SWT folder '%swt_path%' does not exist.
    echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
    goto :EOF

:SetPath
rem Finally exec the java program and end here.
REM set REMOTE_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
call %java_exe% %REMOTE_DEBUG% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*

rem EOF
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #9 on: August 17, 2013, 10:49:00 AM »

I just checked and the script for linux is doing something comparable. Did you try calling

Code: [Select]
android.bat update project --path .

like explained in a previous post?
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #10 on: August 17, 2013, 11:03:24 AM »

I do not know where i must write this command. Android.bat start only SDK manager, where i can only download other modes.  :(
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #11 on: August 17, 2013, 11:14:21 AM »

You run the command from a command line. Open "cmd", change to the directory of your project and then type the command (with full path).

If you haven't worked with the command line a lot, download the complete ADT bundle from here http://developer.android.com/sdk/index.html . Play around a bit with example android projects (File->New->Android Application Project). Once you have a simple "Hello World" running on your device, you will know what to do with the wmelite Android project.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #12 on: August 17, 2013, 01:02:24 PM »

I know CMD.

Please progressively:
I start cmd. I type path (way to android tools)


And now i must update app.
Here is my app files.


I try write command, but wrong.
When i write android update, then cmd see this options:



I try try try, but not i do not know right command :-(





Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #13 on: August 17, 2013, 01:08:10 PM »

Doesn't look so bad actually. Just don't forget the "--path ."

So if setting the path doesn't work you would type

e:\adt-and-so-on\sdk\tools\android.bat update project --path .

Doesn't that work?
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #14 on: August 17, 2013, 01:18:09 PM »

Code: [Select]
E:\adt-bundle-windows-x86_64-20130219\sdk\tools\android.bat update project --path .This is my code.


What i must write instead --path . ? Please example with complete way.
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #15 on: August 17, 2013, 01:21:25 PM »

Change to the root path of your android project (...\sdk\tools\apps\test) and then use the command 1:1

Code: [Select]
android update project --path .

Previously you were in a different directory, not the directory of your game.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #16 on: August 17, 2013, 01:33:43 PM »

When i change way on path E:\adt-bundle-windows-x86_64-20130219\sdk\tools\apps\test

Commands do not work.


Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #17 on: August 17, 2013, 02:51:39 PM »

Please "cd" to your project first:

Code: [Select]
cd \path\to\sdk\tools\apps\test

then try the line with "android" in it.

BTW: Maybe its better for you to use eclipse? Just start the "eclipse.exe" and play around with the GUI.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #18 on: August 17, 2013, 07:49:10 PM »

I try CD, but same problem. Yes i have eclipse, this step can make in it?
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 164
    • View Profile
Re: Convert game by windows to android
« Reply #19 on: August 19, 2013, 08:37:11 AM »

Yes, you launch the eclipse version that comes with your Android tools. Create a new "HelloWord" app and play around with it.

Using eclipse to build the wmelite project would then probably just need a "New Android Project from existing code" from the project creation wizard.
Logged

pirko7

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 166
    • View Profile
Re: Convert game by windows to android
« Reply #20 on: August 26, 2013, 07:42:32 PM »

I used eclipse to build the wmelite project, but "New android project from existing code" not work.

When i imported project folder button for finish not worked. "Click click click" but nothing happens.


Logged
Pages: 1 2 [All]
 

Page created in 0.23 seconds with 23 queries.