Android app opens H5 white screen

Problem: Android app suddenly reports H5 white screen on certain models ( vivo, oppo, Huawei ’s old mobile phones)

Retest situation : Android version 8.1 mobile phone does have a white screen, but only the package in the production environment has a white screen. After packaging Android in the dev and test environments, H5 (corresponding to the H5 domain name link of the environment) can be opened normally (the same mobile phone)

Finally, the problem was discovered : the SSL certificate of the H5 production environment domain name caused an error in the webview, causing the page loading to be terminated, and the H5 page was not loaded.
Solution:
1. Let the operation and maintenance help check possible problems with the SSL certificate
2. Let the app ignore the certificate error , continue loading the H5 page

Because the certificate was provided by an external company, it was troublesome to change it, so I chose the second option.
Then the app said that it had been processed, and indeed there was a processing code. After multiple inquiries, I found that they called
super.onReceivedSslError . (view, handler, error), the implementation of super is sslErrorHandler.cancel();, which terminates access, so be sure not to call super !
Here is the correct processing code:

public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    
    
	// super这个不能调用,如果有用到一定要注释去掉
	//super.onReceivedSslError(view, handler, error);

	handler.proceed();

}

Then the app goes through the normal release process, allowing customers to use the new version of the app to open the H5 page normally.

Guess you like

Origin blog.csdn.net/be_strong_web/article/details/128315140