Closed JcMinarro closed 7 years ago
I was able to use the plugin with beta6. I'll look into it but sounds like RC2 is going to hit sometime next week so not going to spend a lot of time on it.
Ok, we can update the test cases when RC2 and Final version where published, then try to sopport them
So this issues is specifically with kotlin correct?
I just tested on my project (java only) and it's working fine.
Yes, it is when you have kotlin source on your code, but with the new version of the Android Build Plugin
I have been reading the Android Build Plugin migration guide and they have removed certain functionalities to obtain the output directories, and I think that it could be de problem. https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api
Looking into this along with #155 . I have a project that's using both Kotlin and Groovy so I should be able to upgrade using that to look at what's going on.
This issue still exists with Android Studio 3.0. The specific line of code is here:
def kotlinCopyTask = project.tasks.findByName("copy${variantName.capitalize()}KotlinClasses")
return kotlinCopyTask.kotlinOutputDir
kotlinCopyTask
is null.
When I look for tasks, these are the only ones with "[Kk]otlin" in the name
Finding Kotlin-related tasks
task ':app:compileRegularDebugAndroidTestKotlin'
task ':app:compileRegularDebugKotlin'
task ':app:compileRegularDebugUnitTestKotlin'
task ':app:compileRegularLccOldDebugAndroidTestKotlin'
task ':app:compileRegularLccOldDebugKotlin'
task ':app:compileRegularLccOldDebugUnitTestKotlin'
task ':app:compileRegularLccOldReleaseKotlin'
task ':app:compileRegularLccOldReleaseUnitTestKotlin'
task ':app:compileRegularReleaseKotlin'
task ':app:compileRegularReleaseUnitTestKotlin'
An ugly workaround for this, until the new version is released:
// Ugly workaround for incompatibility between Groovy Android Gradle Plugin 1.2.0 and Android Gradle Plugin 3.0.0
// Should be fixed with Groovy Android Gradle Plugin 1.3.0. https://github.com/groovy/groovy-android-gradle-plugin/pull/155
task copy[<Flavor>]DebugUnitTestKotlinClasses(type: CopyKotlinClasses)
class CopyKotlinClasses extends DefaultTask {
def kotlinOutputDir = ["$project.rootDir/app/build/tmp/kotlin-classes/regularDebugUnitTest"]
@TaskAction
def doNothing() {
}
}
This provides the "missing" task the Groovy plugin is looking for, with a non-null kotlinOutputDir
pointing at the correct output path (for my project, at least).
When do you plan to release 1.3.0?
@autonomousapps When it's complete 😀.
Here's an update of what's going on.
3.0.0 source code didn't get released until over the weekend, and due to some changes the unit tests seem to have problems running all at once (they are fine run individually) due to an issue with com.android.build.gradle.internal.BuildSessionImpl
, annotation processor implementations seem to have changed, and kotlin doesn't work with api level of 26+. Also some issues with invokedynamic, which can easily be solved for applications using proguard, but pose a larger problem with library projects.
I will push my progress today to 1.3.0 branch if anyone wants to take a look.
I see! I'm so very glad Google declared AGP 3.0.0 stable!
Snapshot released (2.0.0). Please report any issues you have. The plan is to release it after I update some tests so they are more robust and easier to maintain, as well as figure out a solution to a better solution than progaurd for #145, and of course updating the docs.
I will try it tonight if I have time and let you know if it is working to me
Hi @AndrewReitz I couldn't find the version 2.0.0-SNAPSHOT, The last one that I found was 1.3.0-SNAPSHOT, but it seems to be old because I get the same error "Cannot get property 'kotlinOutputDir' on null object" and I can see that you have removed that code on #158 Did you push the proper version? I am using the following repository, Should I use another one? http://oss.jfrog.org/oss-snapshot-local/org/codehaus/groovy/groovy-android-gradle-plugin/
@JcMinarro There's an issue with artifactory plugin. I'm trying to upload one manually now. https://github.com/JFrogDev/build-info/issues/92
I have tried with the new build that you have pushed and It works like a Charm ;) Good Job
Glad to help. Few more things I want to update and then I'll get 2.0.0 out!
@AndrewReitz any update on this? When can we expect 2.0.0 to be published? :)
The plugin is not compatible with the last Android Gradle Plugin Version (3.0.0-rc1) Seems that on that version they remove some method and the plugin fails when trying to access to the Kotlin output directory. I have added more tests that reproduce the error, but I don't know how to fix it maybe with some help ;) You can see the branch that I have created with that tests: https://github.com/JcMinarro/groovy-android-gradle-plugin/tree/tests-that-fail-with-android-plugin-version-3.0.0-rc1
And here is the failure log: