Android webview only loads 10% and there is a white screen problem troubleshooting

question

There is a main page, and a Webview is included in the layout. When the page jumps to the second page, a new WebView will also be loaded, but the new WebView fails to load the page, and the loading progress reaches 10%, and it does not move. Error message.

        The first thing that happened was that the webView of the main page could not be loaded, but I didn’t think much about it at the time and thought it was a network problem. After killing the process or exiting and re-entering, it returned to normal, so it has not been solved as the main problem. The later stage of the project is Thinking about switching to Tencent’s X5webView , optimizing the webView loading, I found that the project’s homepage opened normally. After normalization, this problem was put into the optimization success function, but I don’t know that the problem has not been really solved. Later, we found a big problem. The whiteboard marker we used could not be loaded. This is our main function, so we stepped up the investigation:

Troubleshoot

1. The first reaction to this problem is that there is a problem with the third party we use. Since we used the beta version at the beginning, the first reaction was that the beta version we used was in arrears and could not be used. After logging in to the background, we found that there was no arrears;

2. Look for students from SonicNet to help check if there is a problem with the whiteboard room we created, or there is a problem with the parameters set (but this is actually unlikely because the previous projects were normal, but before that they were all native Development and only the webView that loads the whiteboard), everything is normal after checking by the technical students of the sound network, and no problems are found.

At this point, I began to suspect whether it was a device problem:

3. Check according to the equipment: the equipment used respectively is Aoyou A11 walkie-talkie, Conquer S29 walkie-talkie, Huawei P30. It was found that when AndroidStudio was used to run directly, Huawei P30 was normal, but when Aoyou A11 walkie-talkie and Conquer S29 walkie-talkie loaded the whiteboard, the webView jumped out after loading 10%, and there was no error message. But after packaging and installing on the device, everything is normal. Here I began to suspect that it was a problem with the incremental operation of Android Studio.

4. After suspecting that it was a problem with the incremental running of Android Studio, I cleared the cache and ran Android Studio, reinstalled Android Studio, and found a new computer to run it again. It can be confirmed here that it is caused by the equipment.

5. Then I began to collect various information on the Internet, and first found a post with the same problem.

Information: Android webview only loads 10% and a white screen appears Troubleshooting_Senior Johngo

The progress of Android WebView is stuck at 10%, the page is blank, the page does not respond, and no error is reported. _A little programmer 11's blog-CSDN blog_webview 10%

But I found that I did not have the above-mentioned problems, so I continued to search. At this time, I suddenly thought that two WebViews, the main page and my annotation page, were loaded in my project at the same time, so I began to wonder whether it was because of multiple activities loading webView caused by the conflict. So I began to search for various information on the Internet, and finally found it.

About the solution to the bug that when multiple activities containing WebView are opened in succession, they appear blank and cannot be loaded.

6. Started the investigation, banned the webView on the home page, and only loaded a whiteboard webView, but found that it still couldn’t be loaded, but at this time I always thought it was caused by the double webView, so I suspected it was a cache problem. So I uninstalled the software directly and found that after reinstalling, hey~ it's normal. Cheers~ cheers~ After all, I have been here for two days. However, re-running the program reappeared. So I tried to directly enter the application information, cleared the cache, and found that the loading was successful when I returned to the application. In this way, I always thought it was a cache problem, and it must be. So I started two days of clearing the cache and troubleshooting; using the code to clear all the records of the webView and all the browser records of the mobile phone every time the page is closed and opened. Both were found to be ineffective. At this point, I have been discouraged and started to find out if I can use the project to jump to the application details page. After the user manually clears the cache once, I can start using it (obviously I have started to catch the blind here), but what makes me crash is that I directly jump into it. Even after clearing the cache it still doesn't work.

7. Then I found that it must be normal to enter the device after killing the process every time, and it will be normal for a period of time. At this point, I started to find out what is the process of clicking the project ICON icon after killing the process. The difference from the device running directly on androidStudio.

In-depth analysis of the App startup process in Android

However, it still didn't solve the problem.

8. At this point, I started to wonder if I could change the webView of Shengwang to X5WebView, so I started to replace the third-party plug-ins used:

https://github.com/netless-io/DSBridge-Android
https://github.com/netless-io/whiteboard-android

However, after this replacement, I ran the demo directly and found that it still didn’t work. It’s over~~ Here it started to crash infinitely~~~~~~ I began to wonder where the problem was, why the home page was loaded successfully but the whiteboard was never successful. .

Ya~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All right. Pack up the mood and start again. Then start from the beginning. Use the demo of X5WebView to start running, and found that it cannot be used here. Alright, let's start here to solve the problem.

9. Look carefully at the log and find that there is an error message. Cheers~~~~~~ I finally saw the error message:

X5 core access: TBS:initX5Core bmttwebview.so is 32-bit instead of 64-bit Problem solution

Here, I basically suspected that it was a problem with different browser kernels or cpu, and then I saw this article

solution:

The common types of CPU architectures on the market are as follows:

1. armeabi-v7a:  32-bit ARM processors of the 7th generation and above

2. arm64-v8a:  8th generation, 64-bit ARM processor

3. armeabi:  The 5th and 6th generation 32-bit ARM processors are used in early mobile phones, but now they are rarely used.

4. x86:  Intel 32-bit processor, used more in tablets and emulators.

5. x86_64:  Intel 64-bit processor, used more in tablets and emulators.

Here are some ideas, first of all, ndk {abiFilters "armeabi" }, after joining, haha, X5WebView is running normally. Hahahaha, the first battle was won. Then start the same solution, haha, the webView of the whiteboard is running normally. Hahaha, it seems to have won.

10. Change the webView of the whiteboard to X5WebView, but it still doesn’t work. how could be? All the problems that cannot be run have been solved, but there are still problems. By the way, there is still the problem of running two webViews at the same time, so I added

mWhiteView.onResume();
mWhiteView.resumeTimers();

Finally everything worked! ! ! ! ! ! ! ! !

To summarize this modification:

1、mWhiteView.onResume();    mWhiteView.resumeTimers();

2、ndk {abiFilters "armeabi" }

3. Change to X5WebView

Remaining issues: At present, the remaining issues are not clear why the system's WebView cannot be loaded, and we will continue to investigate later when we have time

Guess you like

Origin blog.csdn.net/guliang28/article/details/128236284