-->

How to create APK file of Sencha Touch Application

2019-05-11 08:28发布

问题:

I create Sencha Touch Application i wont create APK file of that Application i download sencha sdk tools and configure now what step need to follow to create APK file using sencha-sdk tool

pl help me to create APK file using sencha-sdk tool

回答1:

You can use Phonegap and eclipse to create native apk for andriod

http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart



回答2:

You can also create the apk without sencha sdk tools as follows

Follow the steps

1.- Sign up in https://build.phonegap.com/

2.- In your PC create a new Folder with two new folders, "assets" and "test"

3.- In "assets" move all you sencha touch code

4.- In the root of folder, move your icon (of app), the index.html file (the same index used in sencha touch app) and the "config.xml"

5.- add your principal folder to zip and upload to phonegap

6.- Finally you obtain installers to android, windows phone, blackberry, ios, symbian and webos

config.xml https://build.phonegap.com/docs/config-xml

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns       = "http://www.w3.org/ns/widgets"
    xmlns:gap   = "http://phonegap.com/ns/1.0"
    id      = "Name mobile"
    version     = "1.0.0">
    <name>name Mobile</name>
    <description>
    </description>
    <author href=""
        email="">
        cmujica
    </author>
    <gap:platforms>
        <gap:platform name="android" minVersion="2.3" />
        <gap:platform name="webos" />
        <gap:platform name="symbian.wrt" />
        <gap:platform name="blackberry" project="widgets"/>
    </gap:platforms>
    <icon src="icon.png" gap:role="default" />
    <gap:splash src="assets/images/bg-blue.png" />
    <feature name="http://api.phonegap.com/1.0/network"/>
    <!-- sample preference specification -->
    <!-- <preference name="autorotate" value="false" readonly="true"/> -->
</widget>


回答3:

I would prefer to do it with command in comand prompt.

  1. just make the key store for the app

     keytool -genkey -v -keystore my-release-key.keystore -alias alias_name
     -keyalg RSA -keysize 2048 -validity 10000
    

    replace my with you application name.

  2. make sure that where ever you create the key store copy it from there and put it inside the application then after update the packager.json and give the name for the key store which should be similar to what you hv copied.

  3. make a build folder outside the local server and give it any name and then update the folder name in the packager.json.

  4. Now on your comand prompt go to the app and type

    sencha package build packager.json
    
  5. you will get a package in your build folder.



回答4:

A simple quick way from Sencha Touch to Android apk using the default app that gets generated.

Pre-req: 1) Ant: Configure ANT_HOME and append to Path as %ANT_HOME%\bin; 2) Java: Configure JAVA_HOME and append to Path as %JAVA_HOME%\bin; 3) Ruby 4) Android SDK (If Android SDK is unzipped at C:\Mobile\AdtBundle, then your sdk home is C:\Mobile\AdtBundle\sdk i.e till the sdk folder) 4.1) Append to Path as C:\Mobile\AdtBundle\sdk\tools;C:\Mobile\AdtBundle\sdk\platform-tools; 4.2) Download the required Android API by running the 'C:\Mobile\AdtBundle\SDK Manager.exe', in my case it was androidAPILevel=14 i.e. Android 4.0 5) Certificate Generation: (Run the below command from the command prompt in your JAVA_HOME\bin location. Please note its important to specify the path where the certificate will be stored, in my case its C:\myapp.keystore) keytool -genkey -v -keystore C:\myapp.keystore -alias myapp_alias -keyalg RSA -keysize 2048 -validity 10000

Steps: 1) Generated a new app using the following command from my Touch Directory location, in my case C:\Mobile\touch-2.3.1 sencha generate app MyApp ../MyApp

2) Go to your 'Generated App folder' and open packager.json file. Modify the file as follows.(Please note, I have simply modified this file, haven't removed any attributes that are specific to iPhone, it doesn't really matter whether you remove them or not. Even few params like outputPath wont matter wrt the apk output location. Also update your icon as required by android)

{ "applicationName":"MyApp", "applicationId":"com.mycompany.myapp", "bundleSeedId":"KPXFEPZ6EF", "versionString":"1.0", "versionCode":"1", "icon": { "36":"resources/icons/Icon_Android36.png", "48":"resources/icons/Icon_Android48.png", "57":"resources/icons/Icon.png", "72":"resources/icons/Icon~ipad.png", "114":"resources/icons/Icon@2x.png", "144":"resources/icons/Icon~ipad@2x.png" }, "inputPath":"./", "outputPath":"C:\Mobile", "configuration":"Debug", "platform":"Android", "deviceType":"Universal", "certificatePath":"C:\Mobile\myapp.keystore", "certificateAlias":"myapp_alias", "certificatePassword":"android", "provisionProfile":"", "notificationConfiguration":"", "sdkPath":"C:\Mobile\AdtBundle\sdk", "androidAPILevel":"14", "permissions":[ "INTERNET", "ACCESS_NETWORK_STATE", "CAMERA", "VIBRATE", "ACCESS_FINE_LOCATION", "ACCESS_COARSE_LOCATION", "CALL_PHONE" ], "orientations": [ "portrait", "landscapeLeft", "landscapeRight", "portraitUpsideDown" ]

}

3) Go to your generated app on the command prompt and run the following command sencha app build native

4) Congrats, ur MyApp.apk is avl at 'Generated App folder'\native-package-mobile\MyApp\packager.json\MyApp.apk



回答5:

From the command line you enter

sencha app build native

But before you need to work through packager.json