Я пытаюсь подключить мое приложение android к API, который работает на моем P C.
Я тестирую приложение на моем реальном телефоне. Базовый URL-адрес: http://localhost: 5000 / api / .
object RequestManager {
val interceptor = HttpLoggingInterceptor()
val client = OkHttpClient.Builder().addInterceptor(interceptor).build()
init {
//TODO must be None at live
interceptor.level = HttpLoggingInterceptor.Level.BODY
}
val retrofit = Retrofit.Builder()
.baseUrl("http://localhost:5000/energy/api/")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build()
val service = retrofit.create(Api::class.java)
}
Я пытался go с http: // : 5000 / energy / api / but Я получаю сообщение о неверном запросе.
> D/OkHttp: <-- 400 Bad Request
Любая помощь?