cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Ginchereau <jason...@microsoft.com>
Subject RE: [Android] Library Project/AAR alternatives to current plugin situation
Date Fri, 08 Apr 2016 22:07:11 GMT
Distributing Android platforms and plugins as AAR binaries seems to go against open-source
conventions and the existing Cordova model, where everything is distributed as source. It
also breaks the platform-centric workflow that otherwise allows easily making changes to the
platform and plugin code after it is installed into the app project.

Have you explored a mechanism where the library project files are distributed along with the
source code? Then when the plugin is installed, that project would be added as a project reference
in the application project. React Native (both Android and iOS) uses this model for distributing
and installing plugins that contain native code. [1] It seems like this could solve the same
problems you're attempting to address with the AAR approach, while preserving the benefits
of distributing as source code.

Actually, it looks like Cordova uses project references already for the Android platform,
but not for plugins. Is there a reason why a project reference to the cordova-android lib
project is inconvenient in the embedded-Cordova scenario?


[1] I struggled to find good documentation, but here's the tool that links RN plugins into
RN app projects: https://github.com/rnpm/rnpm, https://github.com/rnpm/rnpm-plugin-link


Jason


-----Original Message-----
From: Joe Bowser [mailto:bowserj@gmail.com] 
Sent: Thursday, April 7, 2016 10:12 AM
To: dev <dev@cordova.apache.org>
Subject: Re: [Android] Library Project/AAR alternatives to current plugin situation

BTW: The library project is in the Android directory of this plugin.  I want to be able to
have our plugins use Library Projects and AARs so that we can get much improved test coverage.

https://github.com/infil00p/cordova-plugin-inappbrowser/tree/aar_poc

On Thu, Apr 7, 2016 at 8:52 AM, Joe Bowser <bowserj@gmail.com> wrote:

> BTW: You can use this to install plugins in an Android Studio project.
> It's a proof-of-concept, but it's a good stop-gap until we get our 
> plugin story figured out.
>
> https://github.com/infil00p/cordova-android-studio
>
> On Thu, Apr 7, 2016 at 5:31 AM, julio cesar sanchez < 
> jcesarmobile@gmail.com> wrote:
>
>> I think it's a good idea as right now you can't install plugins on 
>> the cordova embedded webview use case, not even with plugman.
>>
>> Did you publish it on jcenter or mavencentral? or can you publish on 
>> github the plugin as library project (I mean the plugin  with the 
>> changes you made, but without the cordova sample project)
>>
>> 2016-04-07 2:51 GMT+02:00 Joe Bowser <bowserj@gmail.com>:
>>
>> > On Wed, Apr 6, 2016 at 4:08 PM, Carlos Santana 
>> > <csantana23@gmail.com>
>> > wrote:
>> >
>> > > Does this aligns in a similar way as how phonegap is recommending 
>> > > for
>> iOS
>> > > on using Cocoapods [1] to embed the Cordova WebView into an 
>> > > existing
>> iOS
>> > > App?
>> > >
>> >
>> > Yes, except that I don't think it will be nearly as complex as the 
>> > iOS approach is.
>> >
>> >
>> > >
>> > > Looking only from a Native Android developer eyes this will be 
>> > > the
>> > approach
>> > > I would like if I have a pure native android app and for some 
>> > > reason I
>> > want
>> > > to add a Cordova webview to a portion of my App.
>> > >
>> > > [1]: 
>> > > https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fd
>> > > ocs.phonegap.com%2fdevelop%2f1-embed-webview%2fios%2f%23pods&data
>> > > =01%7c01%7cjasongin%40microsoft.com%7c651246d755c64bec161e08d35f0
>> > > 7b69b%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=shpqixroQaQD9A
>> > > 54eMa1xUmwiCB%2bUN8U97xYJUrpxJs%3d
>> > >
>> > >
>> > > On Wed, Apr 6, 2016 at 5:52 PM Joe Bowser <bowserj@gmail.com> wrote:
>> > >
>> > > > Hey
>> > > >
>> > > > I recently looked at how native Android developers could use 
>> > > > the
>> > current
>> > > > Cordova code with their projects, and I've noticed that there's 
>> > > > some
>> > > major
>> > > > problems with our current approach of just copying the Java 
>> > > > classes
>> > into
>> > > a
>> > > > project, such as resources getting merged together, and other
>> related
>> > > > issues, so I created a project that instead uses the 
>> > > > InAppBrowser
>> > source
>> > > as
>> > > > an Android Library instead of just code thrown over the wall.
>> > > >
>> > > > The main advantage of this approach is that we can now build 
>> > > > the
>> > library
>> > > as
>> > > > an AAR and distribute the plugins and the platform using 
>> > > > jcenter and mavenCentral and allow more Android developers to 
>> > > > be able to use
>> > Cordova
>> > > in
>> > > > their apps and make their apps more hybrid.
>> > > >
>> > > > Anyway, the example code is here.
>> > > >
>> > > > https://github.com/infil00p/Library-Dev-Project
>> > > >
>> > > > I used a Cordova application to demonstrate this, but I could 
>> > > > have
>> > easily
>> > > > used a vanilla Android project.  Hopefully this also allows for
>> certain
>> > > > plugins like the InAppBrowser to be a lot more managable and 
>> > > > will
>> also
>> > > > allow us to add more unit tests to our projects.
>> > > >
>> > > > Any thoughts on this approach versus our current one?
>> > > >
>> > >
>> >
>>
>
>
Mime
View raw message