add ionic framework to an existing android studio app

陌路散爱 提交于 2021-02-07 20:35:07

问题


I'm developing a project with android studio for a ODROID XU4 board. Because of the nature of the project I'm using android studio to make a native app in order to use some of the Harware features of the board as Ethernet, GPIO,... and because there is no intention of developing this for any other platform.

The problem now is that the customer wants a nice looking ionic interface. I've been testing most of the approaches I found in google, ionic forums, stack overflow and many others sites but without success.

The nearest I've got is creating an ionic app, adding android platform and importing it to android studio.

My first question is: 1- Is this the correct approach?

My work flow is:

ionic start myapp 
ionic platform add android
ionic build android

and then I import the myapp folder with android studio. first of all I get an android studio error:

 19:40:40 Migrate Project to Gradle?
         This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
         More Information about migrating to Gradle
         Don't show this message again.
19:40:41 Update Property Files
         The structure of following Android modules was changed:
         android
         CordovaLib
         Would you like to update related project.properties files?
         Only once
         Always for these modules
         Never for these modules
19:40:44 Update Property Files
         The structure of following Android modules was changed:
         android
         Would you like to update related project.properties files?
         Only once
         Always for these modules
         Never for these modules
19:40:45 IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
19:48:09 Error Report: Submitted

Now its time to migrate the project to gradle:

here is the main problem, I don't know where to put the new gradle file or how to continue.

thanks.


回答1:


First off: Your looking in the right direction. This is the correct approach. However, I think your problem is based on the fact that you importing the wrong folder to Android Studio.

Please import the folder "android" that is generated by ionic (cordova) in your myApp/platforms folder.

The recent Versions of cordova are using the Gradle build system. So if generated with a recent version of cordova the gradle build configuration files are already existing in that "android" folder.

By importing the myapp folder (as you did) these files are not present in your Android Studio projekt. Hence you see the error: This project does not use the Gradle build system.



来源:https://stackoverflow.com/questions/33068892/add-ionic-framework-to-an-existing-android-studio-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!