-
Notifications
You must be signed in to change notification settings - Fork 429
KT-22213 - Kotlin Android Extensions experimental mode doesn't work #644
Comments
Does your script compile on the command line? I would expect some sort of failure messages to pop up regarding plugin resolution. One issue may be that the plugin Other issue may be the wrong Id for Another issue may be you haven't specified versions in any of your plugins like |
@mkobit yes, it compiles. Basic Kotlin Android Extensions functionality works (like |
@mkobit I wasn't able to specify plugin version:
and I'm sure I don't have this plugin on the classpath already. As for |
Can you please post your settings.gradle? Maybe that would help?! 🤷♂️
…On Dec 29, 2017 10:20 AM, "nobodysfault" ***@***.***> wrote:
@mkobit <https://github.com/mkobit> I wasn't able to specify plugin
version:
Error resolving plugin [id: 'org.jetbrains.kotlin.android.extensions', version: '1.2.10']
> Plugin request for plugin already on the classpath must not include a version
and I'm sure I don't have this plugin on the classpath already.
As for com.android.application - yes, it resolves correctly.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#644 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe9ZsVfjttif61SCyMQnxpWlsTACwks5tFK7dgaJpZM4ROVsL>
.
|
@StefMa basically it's just
but I've tried custom resolution strategy like this:
even with custom overridden versions, but no luck |
|
@iNoles build script compiles, but with isExperimental = true kotlin-android-extensions-runtime is still not on the classpath. I've cloned |
I've looked into the Kotlin gradle plugin code to find out what happened
under the hood.
As you can see in this file (especially the
class AndroidExtensionsSubpluginIndicator):
https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AndroidSubplugin.kt
You have to apply the kotlin-android. Otherwise it just ignore
"everything"...
TL/DR: Just apply the kotlin-android plugin before the
kotlin-android-extensions and it should work...
👍
…On Jan 2, 2018 9:21 AM, "nobodysfault" ***@***.***> wrote:
@iNoles <https://github.com/inoles> build script compiles, but with
isExperimental = true kotlin-android-extensions-runtime is still not on
the classpath.
I've cloned hello-android sample and added Kotlin Android Extensions here:
https://github.com/nobodysfault/hell-android
I've added kotlinx.android.extensions.LayoutContainer import into
MainActivity.kt to check if experimental mode works. Hope it helps.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#644 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe4TXB9azRRSVhKbrL5ZKi5XOPvxMks5tGebugaJpZM4ROVsL>
.
|
@StefMa it should log this error: "'kotlin-android' plugin should be enabled before 'kotlin-android-extensions'", but no error is logged. |
I've ran For me it looks like a problem with the following code:
but I'm not sure how could I check it. Could it behave differently with the old Groovy build.gradle and kotlin-dsl? |
Ah sry of course. It was my mistake. You already apple kotlin-android 🤦♂️
…On Jan 2, 2018 11:05 AM, "nobodysfault" ***@***.***> wrote:
I've ran hello-android build with --debug, and it looks like this
function works:
https://github.com/JetBrains/kotlin/blob/e2306ecf94d179074b4d0e2fc5098e
039a22fa59/libraries/tools/kotlin-gradle-plugin/src/main/
kotlin/org/jetbrains/kotlin/gradle/internal/AndroidSubplugin.kt#L142
cause there are -P plugin:org.jetbrains.kotlin.android:experimental=true,
plugin:org.jetbrains.kotlin.android:defaultCacheImplementation=hashMap in
compiler args, but Android Extensions runtime is not added to the runtime
dependencies.
For me it looks like a problem with the following code:
extension.setEvaluatedHandler { evaluatedExtension ->
if (evaluatedExtension.isExperimental) {
addAndroidExtensionsRuntimeIfNeeded(project)
}
}
but I'm not sure how could I check it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#644 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe6Bx_HQo0vNcPOE3Ibt1zFMWlcpLks5tGf9-gaJpZM4ROVsL>
.
|
The way the First, it relies on @nobodysfault, could you report this issue on the Kotlin gradle plugin? |
@eskatos thanks for the investigation and explanation. I've reported the issue: https://youtrack.jetbrains.com/issue/KT-22213 |
I've been able to circumvent this by creating a Groovy Gradle script which just enables the experimental mode, and applying the said script in my Kotlin Gradle script.
androidExtensions { experimental = true }
// ...
apply { from("experimentalExtensions.gradle") }
// ... |
Kotlin "released" 1.2.20 yesterday and according to their changelog they have fixed
I think you can give it another try with 1.2.20 ;) |
|
@StefMa @eskatos Nope, it still doesn't work. I've updated Kotlin in my test project and checked it: nobodysfault/hello-android@c8f23a1 |
Yep, KT-20235 is unrelated to this issue. |
Another workaround: androidExtensions {
configure(delegateClosureOf<AndroidExtensionsExtension> {
isExperimental = true
})
} |
Good night. In my case i only coment the apply plugin: 'kotlin-android' just like that: apply plugin: 'com.android.application' apply plugin: 'kotlin-android-extensions' // apply plugin: 'kotlin-android' androidExtensions { and it works. Does it will cause any trouble to me? |
Good morning i solved this issue changing the Sync project that was in off-line mode to on-line mode. to me that was my problem. Thanks guys |
@parcelize still not found
it recongnized |
@hereisderek you have some duplicate lines: |
I understand that. it was just me playing around and added the lines. |
Any updates about this issue? |
The workaround is not longer needed for kotlin 1.3.30.
Works fine. Issue can be closed. |
Thanks for the feedback @SimonSchubert! |
It is worth mentioning that plugin order is important - it is what was causing this problem for me |
maybe related... https://youtrack.jetbrains.com/issue/KT-31043 app start crashing for our users after apply #644 (comment) and Kotlin |
still doesn't work for me
P.S. syntax for gradle (not kotlin dsl) should be |
Guys , good answer , work for me Kotlin plugin should be enabled before 'kotlin-android-extensions' |
Please do not close, it still showing up on Android 3.5.3 Kotlin 1.3.61. I stilll can't get @parcelize to be found. |
apply plugin: 'com.android.application' android { androidExtensions { |
The stackoverflow advice in @steam0111's comment above, worked for me. |
After applying Kotlin Android Extensions plugin I wasn't able to enable its experimental mode.
Expected Behavior
After applying Kotlin/Android plugins in build.gradle (Groovy version):
we could enable Kotlin Android Extensions experimental mode:
./gradle dependencies
shows that there is aorg.jetbrains.kotlin:kotlin-android-extensions-runtime:1.2.10
runtime dependency.Current Behavior
After applying plugins in build.gradle.kts:
experimental mode actually is not enabled e.g. I wasn't able to import
kotlinx.android.extensions.LayoutContainer
class and there is noorg.jetbrains.kotlin:kotlin-android-extensions-runtime:1.2.10
runtime dependencySteps to Reproduce
build.gradle.kts:
After that try to import any experimental Kotlin Android Extensions classes e.g.
kotlinx.android.extensions.LayoutContainer
Update: I've created a sample project demonstrating the issue: https://github.com/nobodysfault/hello-android
It's just a cloned
hello-android
sample with added Kotlin Android Extensions and experimental = true.Vendor issue
https://youtrack.jetbrains.com/issue/KT-22213
The text was updated successfully, but these errors were encountered: