mapkit-android-demo
mapkit-android-demo copied to clipboard
yandex.maps: Certificate is not valid
Карта не отображается. API key правильно подключил. В логах пишет: yandex.maps: Certificate is not valid: Domain specific configurations require that hostname aware checkServerTrusted(X509Certificate[], String, String) is used
@Telzhanov i found a solution link - https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted/52652182 I am surprised that there is little information in the official documentation. Developers are very bad work with it
@Telzhanov i found a solution link - https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted/52652182 I am surprised that there is little information in the official documentation. Developers are very bad work with it
How to solve a problem?
I did everything as written in the answer, as a result, the cards are empty and produce errors that are higher
@FasdAR I tried the second way from Hrishikesh Kadam. It really helped me. I tried to turn off this setting and the cards stopped loading. My configuration is Android 8.0. More information on the Internet, I did not see what can help.
@Erdemtsynduev I did everything the same, but it still does not work :(
@Erdemtsynduev I did everything the same, but it still does not work :(
The second method helped me, from Hrishikesh Kadam
Аналогичная ошибка возникает при добавлении в AndroidManifest.xml секции android:networkSecurityConfig на всех android 7+
<application
android:networkSecurityConfig="@xml/network_security_config">
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system"/>
<certificates src="user"/>
</trust-anchors>
</base-config>
<domain-config>
<domain includeSubdomains="true">github.com</domain>
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</domain-config>
</network-security-config>
При этом в лог попадает следующая информация:
com.yandex.mapkitdemo D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
com.yandex.mapkitdemo E/yandex.maps: Certificate is not valid: Domain specific configurations require that hostname aware checkServerTrusted(X509Certificate[], String, String) is used
com.yandex.mapkitdemo W/yandex.maps: yandex::maps::runtime::network::spdylay::SslSocketImpl::onVerifyCert: Server certificate chain haven't passed validation with trusted roots
com.yandex.mapkitdemo E/yandex.maps: yandex::maps::runtime::network::spdylay::Connector::connect: Could not connect to 87.250.250.139:443, reason: certificate verify failed
com.yandex.mapkitdemo W/yandex.maps: yandex::maps::runtime::logging::warn: Create OpenGl ES context version 3
com.yandex.mapkitdemo W/yandex.maps: decltype: Request 2(spdys://spdy3.mob.maps.yandex.net:443/mapkit2/init/2.x/random?lang=en_BY) failed with error: certificate verify failed
com.yandex.mapkitdemo W/yandex.maps: yandex::maps::runtime::network::http::asio::DnsSocket::pollRead: In DnsSocket object 0x712393de90: async_read_some error happened system:125
com.yandex.mapkitdemo E/yandex.maps: Certificate is not valid: Domain specific configurations require that hostname aware checkServerTrusted(X509Certificate[], String, String) is used
com.yandex.mapkitdemo W/yandex.maps: decltype: Couldn't fetch "https://spdy3.mob.maps.yandex.net:443/mapkit2/init/2.x/random?lang=en_BY" because of: cURL reports 60: SSL certificate verification failed
com.yandex.mapkitdemo E/yandex.maps: Certificate is not valid: Domain specific configurations require that hostname aware checkServerTrusted(X509Certificate[], String, String) is used
com.yandex.mapkitdemo W/yandex.maps: decltype: Couldn't fetch "https://s3.eu-central-1.amazonaws.com/tt3897/tt.json" because of: cURL reports 60: SSL certificate verification failed
Ошибка стабильно возникает при наличии секции <domain-config> независимо от того, какой домен в ней указан.
Если в файле network_security_config.xml оставить только секцию <base-config>, то карты корректно загружаются.
Отмечу, что WebView корректно подключается и загружает данные по url из логов https://s3.eu-central-1.amazonaws.com/tt3897/tt.json при подключенном android:networkSecurityConfig
Словил ту же проблему, при этом взаимодействия с cleartext-траффиком не происходит: проверил с помощью StrictMode.VmPolicy.Builder.detectCleartextNetwork()
Есть продвижение по этому вопросу? Удалять секцию domain-config не кажется адекватным решением
The problem is still actual. Should we wait for any fix?
Написал в техподдержку, пока ничего не ответили.
Написал в техподдержку, пока ничего не ответили.
@teivienn я уже почти год жду)))
It seems Yandex has updated certificates. I've removed cleartextTrafficPermitted and everything works good. Could anyone confirm this?
(Tested on mapkit 3.3.1, 3.4.0 and 4.0-lite)
Устаревшие версии MapKit мы не поддерживаем, в таких случаях рекомендуем обновится, поскольку в последней версии ошибка не воспроизводится.
In such cases, we recommend updating the app because the error is not reproduced in the latest version.