在 android studio 中构建 Ionic 框架 [英] Building Ionic framework in android studio

查看:32
本文介绍了在 android studio 中构建 Ionic 框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 IONIC 框架创建一个混合应用程序,该框架显示通过 HTML5 Canvas 和 JS 实现的多个移动图形.但是,动画在手机(即使是 1GB RAM 的手机)中的渲染速度非常慢.

我们已经识别并下载了 FastCanvas(Cordova/PhoneGap 插件).我们按照 URL 中给出的说明进行操作 -

参考:

https://cordova.apache.org/docs/en/latest/guide/platforms/android/

https://www.codeproject.com/articles/1068176/step-by-step-guide-to-build-ionic-hybrid-app-using

I'm trying to create a hybrid application through the IONIC framework which displays multiple moving graphics implemented through HTML5 Canvas and JS. But, the animation renders very slowly in mobiles (even those with 1GB RAM).

We have identified and downloaded FastCanvas (Cordova/PhoneGap plugin). We followed the instructions given in the URL - https://github.com/phonegap/phonegap-plugin-fast-canvas. But under "Adding FastCanvas to Your Application" we hit a roadblock when we come to instructions 3 and 4 as there are no Java folders in my project.

The example (HTML5 Game) given in the url is done through PhoneGap which has the mentioned folder structure and it works fine when we build through Android studio.

We have tried to build our project (done through ionic framework) through Android Studio but, gradle build system was unable to identify the framework. Request someone to please guide me further to solve this issue since, I'm struggling to come up with a solution for long.

Note: We have already tried Canvas, JS, CSS3 and wizCanvas plugin for the animation but, the output is same - slow.

解决方案

Whoo-hoo. After a long struggle, this is what finally worked for me:

Opening a Project in Android Studio Cordova for Android projects can be opened in the Android IDE, Android Studio. This can be useful if you wish to use Android Studio's built in Android debugging/profiling tools or if you are developing Android plugins. Please note that when opening your project in Android studio, it is recommended that you do NOT edit your code in the IDE. This will edit the code in the platforms folder of your project (not www), and changes are liable to be overwritten. Instead, edit the www folder and copy over your changes by running cordova build.

Plugin developers wishing to edit their native code in the IDE should use the --link flag when adding their plugin to the project via cordova plugin add. This will link the files so that changes to the plugin files in the platforms folder are reflected in your plugin's source folder (and vice versa).

To open a Cordova for Android project in Android Studio:

Launch Android Studio.

Select Import Project (Eclipse ADT, Gradle, etc).

Select the Android platform directory in your project (/platforms/android).

For the Gradle Sync question you can simply answer Yes.

(If prompted to update gradle from v2.3 to 3.3. click Update)

Once it finishes importing, you should be able to build and run the app directly from Android Studio. See Android Studio Overview and Building and Running from Android Studio for more details.

Refs:

https://cordova.apache.org/docs/en/latest/guide/platforms/android/

https://www.codeproject.com/articles/1068176/step-by-step-guide-to-build-ionic-hybrid-app-using

这篇关于在 android studio 中构建 Ionic 框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆