2012-06-07 174 views
0

运行煎茶应用程序,我已经建立在命令行中使用下面的煎茶命令的应用程序如下如何在Android模拟器

煎茶的应用程序创建mysenchaApp /路径/到/ WWW/mysenchaApp

这给了我如下

Code: 

[INFO] Created file C:\path\to\www\mysenchaapp\.senchasdk 
[INFO] Created file C:\path\to\www\mysenchaapp\index.html 
[INFO] Created file C:\path\to\www\mysenchaapp\app.js 
[INFO] Created file C:\path\to\www\mysenchaapp\packager.json 
[INFO] Created file C:\path\to\www\mysenchaapp\app.json 
[INFO] Created file C:\path\to\www\mysenchaapp\app\view\Main.js 
[INFO] Copied dir: C:\path\to\www\mysenchaapp\sdk\src 
[INFO] Copied dir: C:\path\to\www\mysenchaapp\sdk\resources 
[INFO] Copied dir: C:\path\to\www\mysenchaapp\resources\icons 
[INFO] Copied dir: C:\path\to\www\mysenchaapp\resources\loading 
[INFO] Copied dir: C:\path\to\www\mysenchaapp\sdk\command 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\microloader\development.js 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\microloader\testing.js 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\microloader\production.js 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\version.txt 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\sencha-touch.js 
[INFO] Copied file: C:\path\to\www\mysenchaapp\sdk\sencha-touch-all.js 
[INFO] Created file C:\path\to\www\mysenchaapp\resources\sass\app.scss 
[INFO] Created file C:\path\to\www\mysenchaapp\resources\sass\config.rb 
[INFO] Copied file: C:\path\to\www\mysenchaapp\resources\css\app.css 

然后我修改,如下packager.json文件得到它仿真器上运行

Code: 

/** 
    * @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":"My Application", 

    /** 
    * @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.mycompany.myAppID", 

    /** 
    * @cfg {String} versionString 
    * @required 
    * This is the version of your application. 
    */ 
    "versionString":"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":"resources/icons/Icon~ipad.png", 

    /** 
    * @cfg {String} inputPath 
    * @required 
    * This is location of your Sencha Touch 2 application, relative to this configuration file. 
    */ 
    "inputPath":"build/native", 

    /** 
    * @cfg {String} outputPath 
    * @required 
    * This is where the built application file with be saved. 
    */ 
    "outputPath":"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":"AndroidEmulator", 

    /** 
    * @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":"/path/to/certificate.file", 

    /** 
    * @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":"", 

    /** 
    * @cfg {String} sdkPath 
    * This is the path to the Android SDK, if you are developing an Android application. 
    */ 
    "sdkPath":"C:\Program Files\Android\android-sdk", 

    /** 
    * @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":"8", 

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

然后我运行SECHA命令行工具下面的命令

煎茶应用程序构建本地

Code: 

C:\path\to\www\mysenchaapp>sencha app build native 
[INFO] Deploying your application to C:\path\to\www\mysenchaapp\build\package 
[INFO] Copied sdk/sencha-touch.js 
[INFO] Copied app.js 
[INFO] Copied resources/css/app.css 
[INFO] Copied resources/images 
[INFO] Copied resources/icons 
[INFO] Copied resources/loading 
[INFO] Resolving your application dependencies... 
[INFO] Found 139 dependencies. Concatenating all into app.js... 
[INFO] Processed sdk/sencha-touch.js 
[INFO] Minifying sdk/sencha-touch.js 
[INFO] Processed app.js 
[INFO] Minifying app.js 
[INFO] Minifying resources/css/app.css 
[INFO] Minified sdk/sencha-touch.js 
[INFO] Minified app.js 
[INFO] Minified resources/css/app.css 
[INFO] Generated app.json 
[INFO] Embedded microloader into index.html 
[INFO] Packaging your application as a native app... 

C:\path\to\www\mysenchaapp 

这里我现在想上运行Android模拟器这个程序,我创建了一个在eclipse中的android应用程序。

我真的很担心,因为我不能够这样做......

我想知道如何我的煎茶的应用程序添加到该机器人对模拟器中运行呢? 请让我知道,我一直试图解决这个很长一段时间。

请帮助和感谢很多

回答

2

我的答案是正确的只有ü要运行在Eclipse Android模拟器煎茶的应用程序和u与手机的差距没有异议。

如果您使用eclipse创建原生android应用程序,那么它真的很简单,可以在您的android模拟器中运行sencha应用程序。

我可以向你展示一些简单的操作步骤。

1)我建议你使用MDS鼓掌电话差距http://wiki.phonegap.com/w/page/34483744/PhoneGap%20Eclipse%20PlugIn%20for%20Android 来安装phonegap,因为你可能在任何时候都需要它。

2)只要你完成安装,你会看到顶部的电话差距图标。

3)点击它创建一个最小的手机差距项目。

4)你会看到没有必要的东西索引文件。 u能代替索引文件,如下

 <!DOCTYPE html> 
     <html> 
     <head> 
     <title>The Sencha Touch List Component</title> 
     <link rel="stylesheet" href="app.css" type="text/css"> 

     <script type="text/javascript" src="touch/sencha-touch-all.js"></script> 
     <script type="text/javascript" charset="utf-8"> 
     Ext.Loader.setConfig({ 
     enabled: true, 
     paths: { 'Ext': 'touch/src' } 
     }); 
     </script> 
    <script type="text/javascript" src="app.js"></script> 
     </head> 
     <body></body> 
     </html> 

5)然后在资产文件夹U可以创造必要建立一个煎茶application.like应用程序文件夹中,文件夹的样式,触摸文件夹和其他文件夹必要的东西,如CSS文件和app.js.

6)只需在eclipse中浏览web浏览器中的index.html文件,就可以检查配置是否正确。

7)如果它确定,那么你可以在你的android模拟器中运行应用程序,就像你为你的本地应用程序一样。 如果你想这样做你的方式遵循此链接http://docs.sencha.com/touch/2-0/#!/video/native-apis-from-touch

0

在packager.json中将您的平台更改为“Android”。

“AndroidEmulator”不起作用。

我在这一个上击败了我的头靠在墙上两次!

0

可能是this link可以帮你。

我已经成功地在android模拟器中运行我的sencha应用程序。