gradle / kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
https://gradle.org/kotlin/
Other
3.71k stars 432 forks source link

kotlin-android-extensions not working #1387

Closed javalue closed 5 years ago

javalue commented 5 years ago

I want to upgrade android targetsdkversion to 28. When I impletement com.google.android.gms:play-services-ads:18.0.0 after synchronization and build, my view can't find in xxxxxx.kt.

error: xxxxxxx.kt: (100, 25): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public val Activity.tvNickname: TextView! defined in kotlinx.android.synthetic.main.aaa public val Dialog.tvNickname: TextView! defined in kotlinx.android.synthetic.main.aaa public val android.app.Fragment.tvNickname: TextView! defined in kotlinx.android.synthetic.main.aaa public val androidx.fragment.app.Fragment.tvNickname: TextView! defined in kotlinx.android.synthetic.main.aaa

eskatos commented 5 years ago

Hi @javalue, This looks like a Kotlin for Android issue. You'll have a better chance to get help on the Kotlin issue tracker https://youtrack.jetbrains.com/issues/KT

javalue commented 5 years ago

Hi @javalue, This looks like a Kotlin for Android issue. You'll have a better chance to get help on the Kotlin issue tracker https://youtrack.jetbrains.com/issues/KT

emmm, i know the reason is't ok in activity, but not working in fragment, you should import kotlinx.android.synthetic.main.your_fragment.view.* focus ".view", and use view.!!.tv1.text = "123" however, i don't know why change it to this way?

javalue commented 5 years ago

it's just add a view,and find child by the view

javalue commented 5 years ago

it's maybe change in org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0

StefMa commented 5 years ago

This has nothing to do with gradles kotlin DSL. This is an kotlin feature. Questions, issues or feedback should be reported at https://youtrack.jetbrains.com/issues/KT

On Wed, Jun 26, 2019, 10:25 AM javalue notifications@github.com wrote:

it's maybe change in org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gradle/kotlin-dsl/issues/1387?email_source=notifications&email_token=ACOBQ62NS2NU76MSXFKBZWTP4MRY7A5CNFSM4H3FULS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYSYDXY#issuecomment-505774559, or mute the thread https://github.com/notifications/unsubscribe-auth/ACOBQ62LB7IVNLG3TLOG7V3P4MRY7ANCNFSM4H3FULSQ .