第二步 (仅供参考) sencha touch 使用cmd打包apk

最新版本的cmd可以直接将sencha touch项目打包成本地应用,不过还有很多不足,本文仅供参考

通过sencha app build native命令可以直接将项目打包成本地应用,不过在命令运行前需要修改项目中的packager.json文件,不然无法正确打包。

配置如下:

  1 {
  2     /**
  3      * @cfg  applicationName
  4      * @required
  5      * 你的应用程序名称,只能是英文
  6      */
  7     "applicationName": "jy110",
  8 
  9     /**
 10      * @cfg  applicationId
 11      * 你的应用的命名空间
 12      */
 13     "applicationId": "com.jy110",
 14 
 15     /**
 16      * @cfg  bundleSeedId 仅iOS
 17      * A ten character string which stands before aplication ID in Apple Provisioning Portal
 18      */
 19     "bundleSeedId": "KPXFEPZ6EF",
 20 
 21     /**
 22      * @cfg  versionString
 23      * @required
 24      * 版本号
 25      */
 26     "versionString": "1.0",
 27 
 28     /**
 29      * @cfg  versionCode
 30      * @required
 31      * 应用内部版本号(整数)
 32      */
 33     "versionCode": "1",
 34 
 35     /**
 36      * @cfg  icon
 37      * IOS应用图标,参考资料
 38      * https://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
 39      *
 40      * Android应用图标,参考资料
 41      * http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html
 42      * iOS 使用 57, 72, 114 和 144; Android 使用 36, 48 和 72;如果你打包安卓可以忽略ios的配置
 43      */
 44     "icon": {
 45         "36": "resources/icons/icon.png",
 46         "48": "resources/icons/icon.png",
 47         "57": "resources/icons/icon.png",
 48         "72": "resources/icons/icon.png",
 49         "114": "resources/icons/icon.png",
 50         "144": "resources/icons/icon.png"
 51     },
 52 
 53     /**
 54      * @cfg  inputPath
 55      * @required
 56      * 这是你的应用程序的位置,相对于这个配置文件。
 57      */
 58     "inputPath": "./",
 59 
 60     /**
 61      * @cfg  outputPath
 62      * @required
 63      * 应用输出路径。确保输出路径是不是在你的输入路径,否则会陷入死循环
 64      */
 65     "outputPath": "../build/",
 66 
 67     /**
 68      * @cfg  configuration
 69      * @required
 70      *  配置你的应用程序。
 71      * `Debug`调试模式
 72      *  Release 正式发布
 73      */
 74     "configuration": "Debug",
 75 
 76     /**
 77      * @cfg  platform
 78      * @required
 79      * 在这里,您将运行应用程序的平台。可用选项有:
 80      *  - iOSSimulator iOS模拟器
 81      *  - iOS 
 82      *  - Android 
 83      *  - AndroidEmulator Android模拟器
 84      */
 85     "platform": "Android",
 86 
 87     /**
 88      * @cfg  deviceType
 89      * @required
 90      * 你的应用程序运行设备类型。
 91      *
 92      * 如果你开发安卓应用,不用配置
 93      *
 94      * Available options are:
 95      *  - iPhone
 96      *  - iPad
 97      *  - Universal
 98      */
 99     "deviceType": "Universal",
100 
101     /**
102      * @cfg  certificatePath
103      * 证书路径,可以是相对路径也可以是绝对路径。
104      * Android开发必须。
105      */
106     "certificatePath": "../key.store",
107 
108     /**
109      * @cfg  certificateAlias
110      *这是您的证书名称。
111      *    
112      *如果您还没有在OSX上注明这一点,我们将尝试自动为你找到使用applicationID执行证书。
113      *
114      *这只是一个简单的匹配。例如,如果您的证书名称为“iPhone开发:罗伯特·杜根(ABCDEFGHIJ)”,你
115      *可以只把“iPhone开发”。
116      *
117      *当使用Windows上的certificatePath,你不需要指定。
118      */
119     "certificateAlias": "cloudMarket",
120     /**
121      * @cfg  certificatePassword
122      * 这是证书导出过程中指定的密码
123      */
124     "certificatePassword": "******",
125     /**
126      * @cfg  provisionProfile
127      * 个人资料路径(APP_NAME.mobileprovision),你可以创建,然后从苹果公司的供应门户下载
128      */
129     "provisionProfile": "",
130     /**
131      * @cfg  notificationConfiguration
132      * 推送通知的通知的配置,可以是“debug”,“release”或为空,如果你不使用推送通知在您的项目。
133      */
134     "notificationConfiguration": "",
135     /**
136      * @cfg  sdkPath
137      * 如果你正在开发一个Android应用程序,Android的SDK路径
138      */
139     "sdkPath": "F:/adt-eclipse/sdk",
140 
141     /**
142      * @cfg  androidAPILevel
143      * 这是android的API级别,关资料:http://developer.android.com/guide/appendix/api-levels.html。
144      * 必须安装Android SDK管理器
145      */
146     "androidAPILevel": "8",
147 
148     /**
149      * @cfg {Array[String]} permissions
150      * 应用程序的权限列表(仅Android)
151      * 参考资料:http://developer.android.com/reference/android/Manifest.permission.html#ACCESS_CHECKIN_PROPERTIES
152      */
153     "permissions": ["INTERNET", "ACCESS_NETWORK_STATE", "CAMERA", "VIBRATE", "ACCESS_FINE_LOCATION", "ACCESS_COARSE_LOCATION", "CALL_PHONE"],
154 
155     /**
156      * @cfg {Array[String]} orientations
157      * @required
158      * 屏幕控制。
159      */
160     "orientations": ["portrait"]
161 }

 然后就能在build目录下看到打包后的apk,如图:

通过这种打包的apk没有启动图片,应用名称也不支持中文,还带有应用标题栏,可以参照下面的文章做一些修改。我也会查阅其他资料看看

反编译sencha toucha打包的apk文件,修改应用名称支持中文以及去除应用标题栏p>

http://blog.chinaunix.net/uid-20078486-id-3893334.html

原文地址:https://www.cnblogs.com/mlzs/p/3470224.html