Error with latest gradle android plugin (0.5.5) and maven-library plugin

895 views
Skip to first unread message

du...@clover.com

unread,
Aug 2, 2013, 5:46:17 PM8/2/13
to adt...@googlegroups.com
I recently posted about some issues with using the maven-publish plugin and happily got those resolved.

With the latest build of com.android.tools.build:gradle plugin (0.5.5), I get the following error from the project:

> Cannot create a Publication named 'bundleRelease' because this container does not support creating elements by name alone. Please specify which subtype of Publication to create. Known subtypes are: MavenPublication

I'm using the following syntax inside my build.gradle file:

android.libraryVariants
publishing {
  publications {
    maven(MavenPublication) {
      artifact bundleRelease  }}
  repositories {
    maven {
      credentials {
        username = "${artifactory_user}"
        password = "${artifactory_password}" }}}}

When I change the com.android.tools.build:gradle version back to 0.5.4 inside the buildscript block, the error goes away, so it seems to have been newly introduced in 0.5.5.  Of course I've run with gradle -d and it doesn't seem to shed much light on the issue.  Wondering if anyone else has seen this or if I should go ahead and switch to the older style maven plugin to avoid the issue going forward?

Xavier Ducrohet

unread,
Aug 2, 2013, 6:37:05 PM8/2/13
to adt...@googlegroups.com
yes, that is because calling android.libraryVariants doesn't create the tasks anymore (see the release notes), so bundleRelease doesn't existing yet.

The gradleware people and I are collaborating to make sure the new publish stuff (which is still incubating) will work well with android but right now the existing work around will not work unless I add a (temporary) way to force generating the tasks.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

du...@clover.com

unread,
Aug 3, 2013, 9:14:58 PM8/3/13
to adt...@googlegroups.com
Thanks Xavier.  

I have converted over to the older-style maven plugin for now and I have successfully built and deployed to my Maven repository over the network.  Here is what my new configuration looks like:

uploadArchives {
  repositories.mavenDeployer {
      authentication(userName: "${artifactory_user}", password: "${artifactory_password}")
}}}

task sourceJar(type: Jar) {
  from android.sourceSets.main.java
  classifier "sources"
}

artifacts {
  archives(sourceJar)
}

Now I have a couple of additional questions.

1) Does Gradle/Android Studio support downloading attached sources from Maven for an Android Library (AAR) project? I was able to successfully upload an <artifact>-<version>-sources.jar file to Artifactory as above and it sits alongside the .aar file just like it would for a normal JAR deployment, but I don't see Gradle making any attempt to download it and therefore when I click through to a class referenced from the library project, I have to manually attach source in Android Studio. It also seems like the above approach isn't very resilient for supporting non-Java source files like resources, so wondering if there is a preferred approach.
2) I was depending on the Gradle task 'publishToMavenLocal' when using the maven-publish plugin, but for the normal 'maven' plugin, the documentation says to use the 'install' task to install to maven local (~/.m2).  This task name gets clobbered by the android plugin so when I do 'gradle install' I end up running the install to device task versus the maven task.  I found a few old posts where someone had encountered conflicting Gradle task names and it doesn't look like there's a simple workaround for that.  Any suggestions as to what to do here?

Neal Sanche

unread,
Sep 20, 2013, 12:56:51 PM9/20/13
to adt...@googlegroups.com
Are there any more current updates on getting this done since August?

Thanks in advance,

Neal

Artiom Chilaru

unread,
Sep 29, 2013, 5:31:14 PM9/29/13
to adt...@googlegroups.com
I'd love to have an answer to that too :S

Regards,
Artiom

Sylvain Galand

unread,
Dec 10, 2013, 5:24:57 AM12/10/13
to adt...@googlegroups.com


On Sunday, September 29, 2013 11:31:14 PM UTC+2, Artiom Chilaru wrote:
I'd love to have an answer to that too :S

Still not working and Christmas is coming !

--
Sylvain

Xavier Ducrohet

unread,
Dec 10, 2013, 12:44:42 PM12/10/13
to adt...@googlegroups.com
We have no update at this time on this.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ondřej Čermák

unread,
Mar 31, 2014, 6:36:00 AM3/31/14
to adt...@googlegroups.com
Any update now? It'd be nice to have this fixed.
Reply all
Reply to author
Forward
0 new messages