New configurations (implementation, testImplementation, etc) do not work in the dependencies block for an Android project #803
Comments
SolutionI think you need to explicitly add plugins {
`java-library`
} An alternative you can use is this:
Question for the Gradle TeamIs there any way that we can make this error clearer to users that the problem they are experiencing originates from Gradle not knowing about the configuration? I think that Gradle needs to provide more useful information when the compiler can't find things like |
I don't think that this is the a official solution.
The android plugin provides already the implementation/api configuration
(however how). It works with groovy. So why doesn't it work with kotlin?
Seems more a like issue from my side...
…On Mon, Apr 2, 2018, 3:46 PM Jonathan Leitschuh ***@***.***> wrote:
Solution
I think you need to explicitly add java-library to your plugins block
like so for implementation and testImplementation to automatically get
generated for you:
plugins {
`java-library`
}
An alternative you can use is this:
dependencies {
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:1.2.31")
"implementation"("org.jetbrains.kotlin:kotlin-reflect:1.2.31")
}
Question for the Gradle Team
@bamboo <https://github.com/bamboo> @eskatos <https://github.com/eskatos>
@eriwen <https://github.com/eriwen>:
Is there any way that we can make this error clearer to users that the
problem they are experiencing originates from Gradle not knowing about the
configuration?
I think that Gradle needs to provide more useful information when the
compiler can't find things like implementation or testImplementation.
What are your thoughts on this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#803 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe9BXu9xK_tVv4kPERVRcFjzcQpdrks5tkiu2gaJpZM4TDP51>
.
|
Taking a second look at this it might be because the android plugin isn't designed to create the configurations up front and instead adds them later in the plugin lifecycle than the |
Hi @netvl, If you look at the Could you provide a reproducer build or all your build scripts? |
@eskatos yes, as I said, for some strange reason hello-android does have the Apparently if I extract only the build files from my project (and add a virtually empty
I'm not sure what does "cross-configure" mean. I do have several projects in my build, but as far as I understand, they are not affecting each other's configuration,. |
@netvl thanks for the reproducer, much easier to know exactly what is happening. I noticed that you use the |
@eskatos I have no idea what that file does. I'm using IntelliJ IDEA, maybe it generated this file? Indeed, I have removed this file from the project, and it works now. Thank you very much! |
Expected Behavior
implementation
,testImplementation
etc methods in thedependencies
block should work correctly.Current Behavior
implementation
,testImplementation
etc methods give the "unresolved reference" errors:Context
I'm migrating my Android project to use the Kotlin Gradle DSL for the build description. It went mostly smoothly, however, it seems that I can't use the
implementation
,testImplementation
and other new configurations for some reason in Kotlin DSL. It was possible in the regular Groovy DSL, however.Steps to Reproduce (for bugs)
I'm not sure how to reproduce it. Apparently, the example project "hello-android" works correctly when
compile
is changed toimplementation
.Your Environment
I'm using Gradle 4.6 (also tried with 4.5.1), and I have the following
plugins
section:The first plugin is made possible to be enabled by additional configuration in
settings.gradle.kts
:The text was updated successfully, but these errors were encountered: