问题
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