无法解析 TLS 数据包 header android studio

Unable to parse TLS packet header android studio

我想连接我的本地服务器并使用 Retrofit 获取一些数据,但我给出了错误“无法解析 TLS 数据包 header”,我做不到解决这个问题请给我一个解决方案

onFailure: Unable to parse TLS packet header

ServiceBuilder.kt

object ServiceBuilder {
    private val client = OkHttpClient.Builder()
        .connectionSpecs(listOf(ConnectionSpec.MODERN_TLS) )
        .build()

    private val retrofit = Retrofit.Builder()
        .baseUrl(Config().BASE_URL)# "https://10.0.2.2:5000"
        .addConverterFactory(GsonConverterFactory.create())
        .client(client)
        .build()

    fun<T> buildService(service: Class<T>): T{
        Security.insertProviderAt(Conscrypt.newProvider(), 1);
        return retrofit.create(service)
    }
}

LinesrsEndpoint.kt

interface LinesrsEndpoint{
    @GET("/getAllLinesrs")
    fun getLinesrs(): Call<AllLinesrs>
}

LinesRs.kt

data class AllLinesrs(val results:List<Linesrs>)

data class Linesrs(
    var lineId: Int,
    var symbolId: String,
    var lineStart: String,
    var lineEnd: String,
    var lineTimeFrame: String,
    var lineInsertTime: String,
    var lineSensDgre: String,
    var linesrsGroupId: String,
    var userId: String,
    var user: User

)

MainActivity.kt

class MainActivity: AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_add_trend_line)

        val request = ServiceBuilder.buildService(LinesrsEndpoint::class.java)
        val call = request.getLinesrs()

        call.enqueue(object : Callback<AllLinesrs> {
            override fun onResponse(call: Call<AllLinesrs>, response: Response<AllLinesrs>) {
                if (response.isSuccessful) {
                    Log.e("hamid", "onResponse: "+response.body() )
                }
            }

            override fun onFailure(call: Call<AllLinesrs>, t: Throwable) {
                Log.e("hamid", "onFailure: " + t.message)
            }
        })
    }

}

试试这个:将基础 URL 从 https 更改为 http.