Kotlin Fuel REST客户端代理错误
我试图创建一个Android应用程序与Kotlin使用燃料休息客户端,但我在我的Logcat中得到以下错误:E / MultiWindowProxy:getServiceInstance失败!
…和…
getaddrinfo:dev-worktable.pl从代理获取结果gai_error = 11
这是我的MainActivity.kt …
package com.corcode.myapplication import android.support.v7.app.AppCompatActivity import android.os.Bundle import com.github.kittinunf.fuel.httpGet import com.github.kittinunf.result.Result import com.github.kittinunf.result.getAs class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val URL: String = "http://dev-worktable.pl/api/offers/list" URL.httpGet().responseString { request, response, result -> //do something with response when (result) { is Result.Failure -> {} is Result.Success -> { println("Result: ${result.get()}") } } } }
…和build.gradle中的依赖关系
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.0.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.0' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0' compile 'com.github.kittinunf.fuel:fuel:1.9.0' //for JVM compile 'com.github.kittinunf.fuel:fuel-android:1.9.0' //for Android compile 'com.github.kittinunf.fuel:fuel-rxjava:1.9.0' //for RxJava support compile 'com.github.kittinunf.fuel:fuel-livedata:1.9.0' //for LiveData support compile 'com.github.kittinunf.fuel:fuel-gson:1.9.0' //for Gson support }