Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    59
    Vote Rating
    3
    good_c_ryan_19 is on a distinguished road

      3  

    Default Building Sencha Touch 2 + Phonegap Application for Android : Windows

    Building Sencha Touch 2 + Phonegap Application for Android : Windows


    Good day, i just want to share on how i successfully build Sencha Touch Application for Android (.Apk) devices.


    Below are the steps:


    Requirements:
    1. Install Phonegap on CMD: download first nodeJS then execute npm install -g phonegap on command prompt - http://phonegap.com/install/
    2. Download Android SDK : http://developer.android.com/sdk/index.html
    3. Download Sencha Touch 2.1 : http://www.sencha.com/products/touch/download/
    4. Download and Install Sencha CMD 3.0 beta : http://www.sencha.com/products/sencha-cmd/download
    5. Download ANT : http://ant.apache.org/
    6. Java SDK






    Building Sencha Touch 2 + Phonegap Application to .APK Android file Steps:
    1. Cd to Sencha Touch SDK Folder(sencha touch 2.2.1) then Create Sencha Touch Project in Command Prompt : Sencha generate app AppNAme Path
    ex:
    Code:
    sencha generate app Device C:\MobileProject\Device
    2. cd on created project folder then package it by :
    Code:
     sencha app build package
    3. Create Phonegap Android Project by cd on
    Code:
    C:\phonegap-2.9.0\lib\android\bin
    then type create.bat <path> <appid> <appname>
    eg:
    Code:
    create.bat C:\MobileProject\Device\build\Device\android com.company.Device Device
    4. Update Android Project for ant to be working android update project --name <project_name> --target <target_ID>
    --path <path_to_your_project> on default Users\yourname path on cmd
    to check available target type android target list
    eg:
    Code:
    android update project --name Device --target 1 --path C:\MobileDeviceProject\Device\build\Device\android
    5. Now copy cordova js from C:\MobileProject\Device\build\Device\android\assets\www to your sencha touch default project folder and add cordova.js to app.json
    Code:
    { "path": "cordova.js"}
    then build package again
    Now edit build.xml on Sencha Project then add
    Code:
    <target name="-after-build">
    <!--Delete content og android web root -->
    <delete dir="${build.dir}/android/assets/www"/>
    
    
    
    
    <copy todir="${build.dir}/android/assets/www">
    <fileset dir="${build.dir}/package"/>
    </copy> </target>
    Step 6: Create apk file. By cd on C:\MobileProject\Device\build\Device\android then type
    ex:
    Code:
    ant debug && adb install -r ./bin/MyApp-debug.apk



    Regards.




    Online Reference:
    http://robertcorvus.com/how-to-reall...negap-to-work/
    http://vimeo.com/55335529
    http://stackoverflow.com/questions/5...y-on-windows-7
    https://baach.de/Members/jhb/setting...e-command-line

  2. #2
    Sencha User
    Join Date
    Jul 2013
    Posts
    11
    Vote Rating
    0
    leizi is on a distinguished road

      0  

    Default Thanks

    Thanks


    Thank , i will test it.
    Do you know sencha 2.2.1 wil work too ?

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    11
    Vote Rating
    0
    leizi is on a distinguished road

      0  

    Default Still not work

    Still not work


    I have done that , but still get error on using cordova functions.
    Example TypeError: navigator.notification is undefined

  4. #4
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thanks for putting this together.

  5. #5
    Sencha User
    Join Date
    Apr 2013
    Posts
    16
    Vote Rating
    0
    feiqiao is on a distinguished road

      0  

    Default


    what version of phonegap do you use? phonegap 2.9?

    can you provide an guide of integration sencha touch 2.X +phonegap 3.0

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    59
    Vote Rating
    3
    good_c_ryan_19 is on a distinguished road

      0  

    Default


    Hi feiqiao, i used phonegap 2.9.0. There is nothing change on the steps even you used phonegap 3.0.

    Best Regards

  7. #7
    Sencha User
    Join Date
    Jan 2014
    Posts
    16
    Vote Rating
    1
    manishroy is on a distinguished road

      0  

    Default


    Hi All,I am getting this error while packaging the app in step 2.
    Platform : Windows 7
    Error :

    Code:
    BUILD FAILED
    com.sencha.exceptions.ExNotFound: Failed to detect ruby
    Anyone?

  8. #8
    Sencha User
    Join Date
    Jun 2013
    Posts
    59
    Vote Rating
    3
    good_c_ryan_19 is on a distinguished road

      0  

    Default


    Hi @manishroy , on the error it self you must need to install ruby , get it here http://rubyinstaller.org/downloads/

  9. #9
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    run ruby -v at command line to see if you have ruby installed.
    If it is installed then you need to add to your PATH.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  10. #10
    Sencha User
    Join Date
    Jan 2014
    Posts
    16
    Vote Rating
    1
    manishroy is on a distinguished road

      0  

    Default


    Ok. I will install it. But i have a stupid question.

    I am really confused about why we need to install so many things just to have a simple Hello World app on Android using Sencha??

    1> PhoneGap
    2>Android SDK
    3>Sencha SDK
    4> Sencha CMD
    5>Apache Ant
    6> Ruby

    Can someone please explain for each of the points mentioned above about why we need them and how they felicitate in creating a Android App.

    Also in the tutorial to create the App in this thread there is no mention of Ruby. Whatever was mentioned i installed then why i need Ruby?