My apk worked before, but the backend dev had made some updates(JWT and https the server). However, the error when i execute my android app in an emulator (with API version 34) is this:
FATAL EXCEPTION: DefaultDispatcher-worker-2Process: com.example.labiofam_android, PID: 14273javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:356)...
I have this code in res/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?><network-security-config><domain-config cleartextTrafficPermitted="true"><domain includeSubdomains="true">127.0.0.1</domain></domain-config></network-security-config>
and in AndroidManifest.xml i have this:android:networkSecurityConfig="@xml/network_security_config" android:usesCleartextTraffic="true"
my api is local, i'm sure that my server works, because i make queries from postman or swagger and the server responds as well. I'm using retrofit to connect with the server, and the configuration is the following code:
val baseUrl = "https://10.0.2.2:5263/api/" fun getInstance(): Retrofit { return Retrofit.Builder().baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create()) .callFactory(OkHttpClient.Builder().callTimeout(60,TimeUnit.SECONDS).build()) .build() }
I want that my apk works although it's unsecure.