xujiaao / AARLinkSources

Attach sources for .aar dependencies in AndroidStudio.
140 stars 9 forks source link

Build fails with Gradle 2.5 #8

Closed WonderCsabo closed 8 years ago

WonderCsabo commented 9 years ago

If a project is built with Gradle 2.5, the build will fail with the following exception:

Could not find method executeWithoutThrowingTaskFailure() for arguments [] on task ':aarLinkSources'

This is due to a change in Gradle 2.5 : https://github.com/gradle/gradle/commit/f58d618aa912955f01bee42bba828a3b9c3924b3

I already have an easy fix:

try {
    aarLinkSourcesTask.execute()
} catch (e) {
    // maybe log?
}

However i think it would be even better to only execute this plugin if it is in tooling mode, eg. when called by the IDE. This is totally unnecessary when called from command line. I am waiting for feedback on that.

ZacSweers commented 9 years ago

@WonderCsabo your fix isn't really a fix though is it? It just catches the exception and proceeds without actually achieving the purpose of the task?

pcqpcq commented 9 years ago

i don't think this fix is a good idea

WonderCsabo commented 9 years ago

The code above obviously would replace this line.

@hzsweers this is actually a fix, because it calls the execute() method, which is available in Gradle 2.5 instead of executeWithoutThrowingTaskFailure(), which is not.

@pcqpcq well, the code above is ugly, but actually results in the same behavior as the old method. The old method also catched all exceptions silently, and with a reason: an exception in this plugin should not break the build.

But i am not a Gradle API expert, i am open any suggestion. I am just thinking here.

ZacSweers commented 8 years ago

This library is no longer necessary, as sources attachment is now included in android studio as of 1.4 beta 3.

https://code.google.com/p/android/issues/detail?id=59220