preface

In the usual map module development, the most common problem is that the map can not be displayed or can not be located, looking for a long time do not know what the problem is. After working on two or three projects, I learned how to solve these problems. Sum up a few small points below now. In fact, follow these steps to find the problem.

First, the API key problem(Map not displayed)

Check for incorrect keys in the Manifest file. The following is what I encountered in the project: 1) When I cooperated with SVN, my teammate changed the key he applied for to display the map on his device. Later, WHEN I updated it, I did not see it clearly, and SVN replaced the content in the local Manifest file. When I finally re-run, of course, the map doesn’t show up. Just change the key back.

<meta-data
      android:name="com.baidu.lbsapi.API_KEY"
      android:value="wor3W4Dzz8mbUEChE9dPiFcc984xgGRa" />Copy the code

2) I changed Windows system some time ago.Java,The androidThe environment was reconfigured, and the map didn’t show up when you re-imported the backup project files. In fact, during the reconfiguration, the value of Andorid signature certificate SHA1 has changed, so we need to go to baidu API console to change the SHA1 value of the application.

Service problem(Unable to locate)

Check the Manifest file, whether registered baidu positioning Service.

   <service
        android:name="com.baidu.location.f"
        android:enabled="true"
        android:process=":remote" />Copy the code

Third, the problem of so library(Unable to locate)

1) In the folder where the SO library file is stored, check whether the SO library file is lost in the folder under the folder corresponding to the device CPU.

   

2) Check whether the version of baidulbs_android. jar in the libs folder is the same as that of the so library.

   

Download SDK, get a compressed package, so library and JAR package are corresponding, it is best not to replace a separate SO file. As time goes by, Baidu will also launch updated versions, so library files of the new version and the old version may not be used together.

   

4. Initialization problem(Crash)

Does this line of code initialize the SDK before using the map?

 SDKInitializer.initialize(getApplicationContext());Copy the code

Fifth, network problems(Map not displayed)

See if your device is connected to the wrong WIFI.

(Last time becausetestConnected to the wrong wifi, the map is not displayed, so it is stuck for most of the day.