skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html
Apache License 2.0
3.69k stars 289 forks source link

class file for kotlin.jvm.functions.Function0 not found #80

Closed znakeeye closed 4 years ago

znakeeye commented 4 years ago

In Android Studio 4.0.1, create a new Java project. Then modify it as follows.

build.gradle

dependencies {
    // ...
    implementation "com.github.skydoves:balloon:1.1.9"
}

MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // ...

    final Balloon balloon = new Balloon.Builder(this).build();
    balloon.setOnBalloonDismissListener(new OnBalloonDismissListener() {
        @Override
        public void onBalloonDismiss() {
        }
    });
}

Build the project, and observe the compilation error:

... MainActivity.java:24: error: cannot access Function0 balloon.setOnBalloonDismissListener(new OnBalloonDismissListener() { ^ class file for kotlin.jvm.functions.Function0 not found

What am I missing here?

skydoves commented 4 years ago

Hi, @znakeeye! It seems to need to add Kotlin dependencies to your gradle.

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
znakeeye commented 4 years ago

Thanks. I should have read the docs.