Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
728 views
in Technique[技术] by (71.8m points)

cordova - Building Ionic framework in android studio

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

enter image description here

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...