简体   繁体   English

Sencha Touch 2-帮助在PC上创建.apk文件

[英]Sencha Touch 2 - Help to create .apk file on PC

I´m starting with sencha touch 2 tech,and now I´m stuck in creating the .apk file. 我从sencha touch 2技术入手,现在我只能创建.apk文件。 This is what I have done since the begining to where I´m stuck: 这是我从一开始就陷入的困境:

  1. Download Sencha Touch SDK 下载Sencha Touch SDK
  2. Install Java JDK 安装Java JDK
  3. Install NodeJS 安装NodeJS
  4. Install Ruby 安装Ruby
  5. Install Sencha CMD 安装Sencha CMD

After that I created my app: 之后,我创建了我的应用程序:

In the command line --> sencha generate app MY_APP_NAME MY_APP_FOLDER(I use the folder www of my wamp server) 在命令行-> sencha生成应用程序MY_APP_NAME MY_APP_FOLDER(我使用我的Wamp服务器的文件夹www)

Then with Eclipse for PHP Developers,I opened the folder and start editing the files to create my app. 然后使用Eclipse for PHP Developers,打开文件夹并开始编辑文件以创建我的应用程序。

Now I have finished my app and want to create the .apk file to test it in a real device(in my wamp server runs perfect). 现在,我已经完成了我的应用程序,并想要创建.apk文件以在真实设备中对其进行测试(在我的Wamp服务器中运行完美)。

And I´m stuck on how to create the apk file,I have read lots of tutorials but no one is clear. 而且我对如何创建apk文件一无所知,我已经阅读了很多教程,但没有人知道。

Please some help on how to create the .apk file step by step or something helpfull. 请一些有关如何逐步创建.apk文件的帮助或其他有用的方法。

Thanks. 谢谢。

Create Simple Android Project in Eclipse and put your www folder in assets folder. 在Eclipse中创建简单的Android项目,然后将www文件夹放入资产文件夹。

And write below code in your MainActivity: 并在MainActivity中编写以下代码:

@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        super.loadUrl("file:///android_asset/www/index.html"); 
    }

Now simply run your Application. 现在,只需运行您的应用程序。

For creating apk files, you can create and setup Cordova environment as described here . 要创建apk文件,您可以按照此处所述创建和设置Cordova环境。

For some additional help, see this reference . 有关其他帮助,请参见本参考

Once you want to make apk for your android device. 一旦您要为您的android设备制作apk。 Just go through the steps here . 只需通过这里的步骤。 But i will advice you to use build of your app to work with in your cordova app. 但是我会建议您使用您的应用程序构建来在Cordova应用程序中使用。

After making build of your project, Check the following steps: 构建项目后,请检查以下步骤:

cordova create yourapp com.example.yourapp YourApp

cd yourapp

cordova platform add android

cordova build android

After this you should copy your project and paste it into the immediate www folder of your cordova project. 之后,您应该复制您的项目并将其粘贴到cordova项目的直接www文件夹中。 And then run 然后跑

cordova run android

Deploy the .apk file in your emulator or real device to test the app. 在模拟器或真实设备中部署.apk文件以测试应用程序。

Let me know if it helps. 让我知道是否有帮助。

Finally I solve my problem. 最后,我解决了我的问题。 I found that through this link it autogenerates the files. 我发现通过链接可以自动生成文件。 Before I discovered that you need to create via sencha cmd the production files through the command in the app folder: sencha app build production 在我发现您需要通过sencha cmd通过以下app文件夹中的命令创建生产文件之前:sencha app build production

With this two steps I created the .apk file,donwloaded and tested it. 通过这两个步骤,我创建了.apk文件,下载并对其进行了测试。

Thanks to the previous comments. 感谢之前的评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM