You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Ari Najarian (JIRA)" <ji...@apache.org> on 2016/05/18 23:25:12 UTC

[jira] [Commented] (CB-11244) Update Android Project Structure to be more compatible with Android Studio

    [ https://issues.apache.org/jira/browse/CB-11244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15290081#comment-15290081 ] 

Ari Najarian commented on CB-11244:
-----------------------------------

I'm currently working on an initiative that will encourage novice coders to build mobile apps using Cordova, and I'm trying to minimize the amount of friction it will take to get their workflow going. At some point, they're going to have to clone a project template, build it and then run it. I'm hoping to have them simply type `cordova prepare android` to initialize a project, then import it into Android Studio to run in an emulator, etc.

Right now, when I try to follow this workflow, I get a jarring notification from Android Studio on import: 'The project is using an old version of the Android Gradle plugin.' It tells me to upgrade to 2.1.0 to take adantage of Instant Run, etc. When I click the 'Update' button, it updates `platforms/android/cordovalib/build.gradle' to 2.1.0, then drops me into the project with the same error reported twice (for `android/cordovalib/build.gradle` and `android/build.gradle` : "Gradle version 2.10 is required. Current version is 2.2.1"... Clicking on the hyperlinked 'Fix Gradle wrapper and re-import project' causes a cryptic IDE error.

This is really messy, and I can't imagine a beginner not feeling overwhelmed and discouraged when they try to build and run a simple project. I suspect that once [~bowserj]'s proposed changes are implemented, all of this will go away, as it seems like this is all a symptom of Cordova autogenerating incompatible files.

In the meantime, could somebody recommend an easy way to successfully import a Cordova project into the latest version of Android Studio?

> Update Android Project Structure to be more compatible with Android Studio
> --------------------------------------------------------------------------
>
>                 Key: CB-11244
>                 URL: https://issues.apache.org/jira/browse/CB-11244
>             Project: Apache Cordova
>          Issue Type: Improvement
>            Reporter: Joe Bowser
>            Assignee: Joe Bowser
>              Labels: CordovaAndroidSix
>
> Currently our existing Android projects have the old Android Project structure created by default, even for new projects, which makes no sense since we no longer support Eclipse as the default project editor and have moved to Android Studio for Android development.
> The main reason for doing this is to clean up dependencies and to allow for projects and dependencies to work more like how modern Android projects work and to remove as much custom Gradle code as possible.  This would also allow us in the future to move towards having Android Plugin code work as Android Libraries with Resources instead of just copying things across, which gives us the ability to add JUnit tests and bundled resources.  This would dramatically increase the quality of plugins such as InAppBrowser, and third party plugins such as the Barcode Scanner.
> This would have to be done on the next major version, and the upgrade would be tricky to do.  However, the benefits at this point would greatly outweigh the costs of maintaining the old project structure.  The old cordova-common code in Cordova-Android 5.0.x would allow for plugins in the short term to work with both projects until we get the new project structure ready.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org