You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Axel Nennker <ig...@gmail.com> on 2015/06/01 20:40:56 UTC

plugins on Android

Hi,

the documentation here

https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html#Plugin%20Specification_info_element

says that some tasks needed by <framework ...> are not done by plugman.

<framework src="extras/android/support/v7/appcompat" custom="false">


But it seems quite easy to do this by calling this command e.g. for Google
Play Services:
$ android update project --path . --library
/home/ignisvulpis/Android/Sdk/extras/google/google_play_services/libproject/google-play-services_lib/
--target android-21

Cordova has all the information that is needed, right?!
Or doesn't this work in all cases?

My latest custom plugin can not be added to my project because plugman's
android.js calls the property-parser which tries to determine the
androidSdkDir which fails because it tries to open local.properties which
was not created (by cordova).
Why doesn't plugman try ANDROID_HOME (too)?

I think that using "android update project ..." would always work instead
of plugman editing project file directly.

Axel

ps: There are several unanswered
stackoverflow questions regarding Google Play Services and Cordova
http://stackoverflow.com/questions/22002424/admob-with-cordova-3-and-google-play-services
http://stackoverflow.com/questions/30399421/cordova-testing-google-play-game-services
http://stackoverflow.com/questions/25872707/how-to-link-google-play-services-to-cordova-project

Re: plugins on Android

Posted by Axel Nennker <ig...@gmail.com>.
If a developer writes a plugin that adds a framework in the <platform
name="android" ..> section then the android sdk needs to be installed
anyways to build the app later, right?

But OK.

Still plugman tries to read project_dir/local.properties to get sdk.dir
which fails because local.properties does not exist
https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/platforms/android.js#L36
Called from here
https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/platforms/android.js#L138
where the framework is handled.

How can this ever have worked?
Couldn't Cordova tell plugman which sdk to use?

-Axel



2015-06-02 15:58 GMT+02:00 Andrew Grieve <ag...@chromium.org>:

> We want plugman to always work, even if you don't have the android sdk
> installed. So, plugman calling "android update project" is not allowed.
>
> As of cordova-5.0, this line will be re-written by the build script to its
> Gradle equivalent, where no "android update project" call is necessary
> (this was an ANT thing)
>
> One issue we have seen with gradle though, is that people haven't installed
> the Support Repository into their SDK. We could consider having the android
> build script detect whether the requisite directories exist on the machine,
> and show an error earlier in this case.
>
> On Mon, Jun 1, 2015 at 2:40 PM, Axel Nennker <ig...@gmail.com>
> wrote:
>
> > Hi,
> >
> > the documentation here
> >
> >
> >
> https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html#Plugin%20Specification_info_element
> >
> > says that some tasks needed by <framework ...> are not done by plugman.
> >
> > <framework src="extras/android/support/v7/appcompat" custom="false">
> >
> >
> > But it seems quite easy to do this by calling this command e.g. for
> Google
> > Play Services:
> > $ android update project --path . --library
> >
> >
> /home/ignisvulpis/Android/Sdk/extras/google/google_play_services/libproject/google-play-services_lib/
> > --target android-21
> >
> > Cordova has all the information that is needed, right?!
> > Or doesn't this work in all cases?
> >
> > My latest custom plugin can not be added to my project because plugman's
> > android.js calls the property-parser which tries to determine the
> > androidSdkDir which fails because it tries to open local.properties which
> > was not created (by cordova).
> > Why doesn't plugman try ANDROID_HOME (too)?
> >
> > I think that using "android update project ..." would always work instead
> > of plugman editing project file directly.
> >
> > Axel
> >
> > ps: There are several unanswered
> > stackoverflow questions regarding Google Play Services and Cordova
> >
> >
> http://stackoverflow.com/questions/22002424/admob-with-cordova-3-and-google-play-services
> >
> >
> http://stackoverflow.com/questions/30399421/cordova-testing-google-play-game-services
> >
> >
> http://stackoverflow.com/questions/25872707/how-to-link-google-play-services-to-cordova-project
> >
>

Re: plugins on Android

Posted by Andrew Grieve <ag...@chromium.org>.
We want plugman to always work, even if you don't have the android sdk
installed. So, plugman calling "android update project" is not allowed.

As of cordova-5.0, this line will be re-written by the build script to its
Gradle equivalent, where no "android update project" call is necessary
(this was an ANT thing)

One issue we have seen with gradle though, is that people haven't installed
the Support Repository into their SDK. We could consider having the android
build script detect whether the requisite directories exist on the machine,
and show an error earlier in this case.

On Mon, Jun 1, 2015 at 2:40 PM, Axel Nennker <ig...@gmail.com> wrote:

> Hi,
>
> the documentation here
>
>
> https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html#Plugin%20Specification_info_element
>
> says that some tasks needed by <framework ...> are not done by plugman.
>
> <framework src="extras/android/support/v7/appcompat" custom="false">
>
>
> But it seems quite easy to do this by calling this command e.g. for Google
> Play Services:
> $ android update project --path . --library
>
> /home/ignisvulpis/Android/Sdk/extras/google/google_play_services/libproject/google-play-services_lib/
> --target android-21
>
> Cordova has all the information that is needed, right?!
> Or doesn't this work in all cases?
>
> My latest custom plugin can not be added to my project because plugman's
> android.js calls the property-parser which tries to determine the
> androidSdkDir which fails because it tries to open local.properties which
> was not created (by cordova).
> Why doesn't plugman try ANDROID_HOME (too)?
>
> I think that using "android update project ..." would always work instead
> of plugman editing project file directly.
>
> Axel
>
> ps: There are several unanswered
> stackoverflow questions regarding Google Play Services and Cordova
>
> http://stackoverflow.com/questions/22002424/admob-with-cordova-3-and-google-play-services
>
> http://stackoverflow.com/questions/30399421/cordova-testing-google-play-game-services
>
> http://stackoverflow.com/questions/25872707/how-to-link-google-play-services-to-cordova-project
>