Kotlin: Unresolved reference:get


#1

I’m trying to import khttp to my Kotlin project on IntelliJ. I have used Grandle. My build.grandle is

buildscript {

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.1"

    }
} 
apply plugin: 'java'
apply plugin: 'kotlin'

sourceCompatibility = 1.5

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.1"
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile "com.github.jkcclemens:khttp:d4c7950154"
}

What can I do ?


#2

A short note ahead: Kotlin requires at least Java 6. You might want to correct your sourceCompatibility.

Here’s the output that I get when I run your build.gradle:

22:01 $ ./gradlew build
:compileKotlin
Download https://jitpack.io/com/github/jkcclemens/khttp/d4c7950154/khttp-d4c7950154.pom
Download https://repo1.maven.org/maven2/org/json/json/20150729/json-20150729.pom
Download https://jitpack.io/com/github/jkcclemens/khttp/d4c7950154/khttp-d4c7950154.jar
Download https://repo1.maven.org/maven2/org/json/json/20150729/json-20150729.jar
No Kotlin files found, skipping Kotlin compiler task
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestKotlin
No Kotlin files found, skipping Kotlin compiler task
:compileTestJava
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build

BUILD SUCCESSFUL

Total time: 15.133 secs

Please post the full error message because it can’t be reproduced with what you show us in your initial posting. May I kindly ask that you also improve the formatting to improve readability. Thank you!


#3

Finally I’m using Fuel library https://github.com/kittinunf/Fuel instead of Khttp and it works… I think it wasn’t build.grandle fault. Maybe Khttp is not updated.