Create Apk in Sencha

At start creating apk in Sencha is a very headache task. It requires a lot of struggle.

The offical link of creating apk from Sencha is

http://docs.sencha.com/touch/2-0/#!/guide/native_android

If we copy the sample code of apk creating from above link and run then we will notice the code is not completed. It lacks some attributes that is essential to create apk.

Sample debug configuration file

{
    "applicationName":"SenchaTouch2Package",
    "applicationId":"com.sencha.Touch2Package",
    "iconName":"icon.png",
    "versionString":"1.0",
    "outputPath":"~/Desktop/STBuild-Android",
    "webAppPath":"~/Desktop/www/",
    "configuration":"Debug",
    "platform":"Android",
    "deviceType":"Universal",
    "certificatePath":"~/Desktop/debug.keystore",
    "certificateAlias":"androiddebugkey",
    "sdkPath":"~/Desktop/android-sdk-mac_x86",
    "orientations": [
        "portrait",
        "landscapeLeft",
        "landscapeRight",
        "portraitUpsideDown"
    ]
}

I managed an apk that is complete having all attributes in the file to create apk.

{

/////////////////////////////////////////////////////////
/**
* @cfg {String} applicationName
* @required
* This is the name of your application, which is displayed on the device when the app is installed. On IOS, this should match
* the name of your application in the Apple Provisioning Portal.
*/
“applicationName”:”myApp”,

/**
* @cfg {String} applicationId
* This is the name namespace for your application. On IOS, this should match the name of your application in the Apple Provisioning Portal.
*/
“applicationId”:”com.java.myApp”,

/**
* @cfg {String} versionString
* @required
* This is the version of your application.
*/
“versionString”:”1.0″,

“versionCode”:”1.0″,

/**
* @cfg {String} iconName
* This is file name of your icon. This should be in the same directory of this configuration file.
*
* For iOS, please refer to their documentation about icon sizes:
* https://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
*
* For Android, please refer to the Google Launcher icons guide:
* http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html
*/

“iconName”:”icon.png”,
/**
* @cfg {String} inputPath
* @required
* This is location of your Sencha Touch 2 application, relative to this configuration file.
*/
“inputPath”:”C:/xampp/htdocs/myApp”,

/**
* @cfg {String} outputPath
* @required
* This is where the built application file with be saved.
*/
“outputPath”:”C:/xampp/htdocs/myApp/build”,

/**
* @cfg {String} configuration
* @required
* This is configuration for your application. `Debug` should always be used unless you are submitting your app to an online
* store – in which case `Release` should be specified.
*/
“configuration”:”Debug”,

/**
* @cfg {String} platform
* @required
* This is the platform where you will be running your application. Available options are:
* – iOSSimulator
* – iOS
* – Android
* – AndroidEmulator
*/
“platform”:”Android”,

/**
* @cfg {String} deviceType
* @required
* This is device type that your application will be running on.
*
* If you are developing for Android, this is not necessary.
*
* Available options are:
* – iPhone
* – iPad
* – Universal
*/
“deviceType”:”Universal”,

/**
* @cfg {String} certificatePath
* This is the location of your certificate.
* This is required when you are developing for Android or you are developing on Windows.
*/
“certificatePath”:”C:/”,

/**
* @cfg {String} certificateAlias
* This is the name of your certificate.
*
* IF you do not specify this on OSX, we will try and automatically find the certificate for you using the applicationId.
*
* This can be just a simple matcher. For example, if your certificate name is “iPhone Developer: Robert Dougan (ABCDEFGHIJ)”, you
* can just put “iPhone Developer”.
*
* When using a certificatePath on Windows, you do not need to specify this.
*/
“certificateAlias”:”androiddebugkey”,

/**
* @cfg {String} sdkPath
* This is the path to the Android SDK, if you are developing an Android application.
*/
“sdkPath”:”D:/android-sdk-windows3.0″,

/**
* @cfg androidAPILevel
* This is android API level, the version of Android SDK to use, you can read more about it here: http://developer.android.com/guide/appendix/api-levels.html.
* Be sure to install corresponding platform API in android SDK manager (android_sdk/tools/android)
*/
“androidAPILevel”:”10″,

/**
* @cfg orientations
* @required
* This is orientations that this application can run.
*/
“orientations”: [
“portrait”,
“landscapeLeft”,
“landscapeRight”,
“portraitUpsideDown”
]
}

////////////////////////////////////////////////////////////////////////////////

;;

Advertisements
This entry was posted in Sencha Touch. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s