f2prateek/dart

Henson with Kotlin

beyerss opened this issue · 2 comments

Hi, I'm using Android Studio 3.0.1 with Kotlin and I want to integrate Dart + Henson. To do this I started by adding the following to my grade file:

implementation 'com.f2prateek.dart:dart :2.0.3'
kapt 'com.f2prateek.dart:dart-processor:2.0.3'
implementation 'com.f2prateek.dart:henson:2.0.3'
kapt 'com.f2prateek.dart:henson-processor:2.0.3'`

I then created a new activity named WebViewActivity:

class WebViewActivity : Activity() { @BindView(R.id.webView) lateinit var webView: WebView
@InjectExtra
lateinit var url: String

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_web_view)
    ButterKnife.bind(this)
    Dart.inject(this)

    webView.loadUrl(url)
}}</code>

Then I moved to my first activity and tried to call Henson.with(this). That did not work. Autocomplete would not suggest Henson and when I type it manually there is a compiler error.

I'm trying to figure out if I missed something or if there are compatibility issues with Kotlin.

We are not aware of any incompatibility with kotlin. And helas, we actually don't use it yet.
There are a few things you can do to understand more the issue,

  1. is it only an IDE issue but it's actually working on command line ?
  2. Also, are files generated properly ?
  3. what is the impact of lateinit when you declare your field ?

@beyerss This library works well with Kotlin and as a section in the README that refers to it.

From what I see I'd say you didn't apply the kapt plugin in your build.gradle

apply plugin: 'kotlin-kapt'