Skip to content

How to create a phonegap cocos html5 (Tutorial 2 Android)

VOZAX edited this page Aug 7, 2015 · 7 revisions

You need read Tutorial 1 at the first step

[How to create a phonegap cocos html5 (Tutorial 1 Google Chrom Browser)](https://github.com/yuye-liu/phonegap-cocos-html5/wiki/How-to-create-a-phonegap-cocos-html5-(Tutorial-1-Google-Chrom-Browser)

ANDROID

Step1:

You shuould setup you android develop environment at first.

Tutorial for setting up android environment

Step2:

You need Download "ANT" for android compiling and setup "ANT" as a system environmental variables

Downloding ANT

i.e MacOS

  1. open config file
cd && vim .bash_profile
  1. press "i" to insert code like below:
export ANT_ROOT="/Users/UserName/apache-ant-1.9.3/bin"
export PATH=$PATH:$ANT_ROOT
  1. press ":wq" to save your file

Here is a tutorial for windows

How to set the path and environment variables in Windows

Step3:

Seting orientation

You can go to you open "AndroidManifest.xml" under this path(it depends on the position of your project)

cd /Users/UserName/phonegap-cocos-html5/platforms/android

Inserting code

android:screenOrientation="landscape"

in <activity like below code:

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="HelloWorld" android:screenOrientation="landscape" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Step4:

Creating android project

$ cd ProjectName
$ phonegap run android