Android uses Baidu map to display a blue screen when it returns and locates. android blue screen

Source: Internet
Author: User

Android uses Baidu map to display a blue screen when it returns and locates. android blue screen

Directory

1. Android uses Baidu map to crash

2. Android uses Baidu map to locate blue screen problems

 

 

1. Android uses Baidu map to crash

Generally, the flashback is not configured in the application tag in the AndroidManifest. xml file.

<meta-data    android:name="com.baidu.lbsapi.API_KEY"    android:value="D9Lh8MrrLMUuXdWMU8tRLtDsta6PoaYN" />

However, some students found that all configurations follow the steps on the official website or tutorial, And the configuration will still crash. In this case, do not blindly search the Internet and use Baidu map to flash back to solve the problem. It will take a lot of time to know where the problem exists, but the problem still cannot be solved.

 

At this time, you need to learn to view the debugging log information provided by AndroidStudio. Open Android Monitor at the bottom of Android Studio to view the specific error message. For example:

 

 

The error message and solution described in this article are as follows:

Error message:

dlopen("/data/data/com.zhoupan.unlockinguser/files/libs/libBaiduMapSDK_base_v4_1_1.so", RTLD_LAZY) failed: dlopen failed: "/data/data/com.zhoupan.unlockinguser/files/libs/libBaiduMapSDK_base_v4_1_1.so" is 32-bit instead of 64-bit11-05 14:02:48.554 17515-17515/com.zhoupan.unlockinguser E/NativeLoader: loadException                                                                         java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.zhoupan.unlockinguser/files/libs/libBaiduMapSDK_base_v4_1_1.so" is 32-bit instead of 64-bit                                                                             at java.lang.Runtime.load(Runtime.java:331)                                                                             at java.lang.System.load(System.java:982)                                                                             at com.baidu.platform.comapi.NativeLoader.f(Unknown Source)                                                                             at com.baidu.platform.comapi.NativeLoader.b(Unknown Source)                                                                             at com.baidu.platform.comapi.NativeLoader.a(Unknown Source)                                                                             at com.baidu.platform.comapi.NativeLoader.c(Unknown Source)                                                                             at com.baidu.platform.comapi.NativeLoader.loadCustomizeNativeLibrary(Unknown Source)                                                                             at com.baidu.platform.comapi.NativeLoader.loadLibrary(Unknown Source)                                                                             at com.baidu.platform.comapi.a.<clinit>(Unknown Source)                                                                             at com.baidu.platform.comapi.b.a(Unknown Source)                                                                             at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source)                                                                             at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source)                                                                             at com.zhoupan.unlockinguser.application.LocationApplication.onCreate(LocationApplication.java:32)                                                                             at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)  

Solution:
The reason is that the fresco library is loaded in the build file.
// Compile 'com. facebook. fresco: 0.9.0 +'
You can run it after deleting it.

 

Original article link

 

 

2. Android uses Baidu map to locate blue screen problems

The reason is targetVersion> = 23. By default, all permissions are disabled when the device is running to 6.0 or above,

Dynamic requestPermission is required. The location permission is required here. This result is returned if it is not enabled by default.

Set targetVersion to 22 or lower. When targetVersion is less than 23, all permissions are enabled by default.

Original article link

 

Appendix:

To implement Baidu map positioning, when using GEO, you need to use maker to display icons and text information, Baidu map officially provides a class that can only display pictures. If you need to display text, you need to implement it by yourself. The specific implementation method is as follows:

An Implementation Scheme for adding text to Baidu map marker

First, add a layout file with the following code:

<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: background = "@ android: color/transparent" android: gravity = "center_vertical" android: orientation = "vertical" android: padding = "10dp"> <TextView android: id = "@ + id/dancegroup_place_name" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_gravity = "center_horizontal" android: textSize = "15sp" android: text = "Hubei Province" android: textColor = "@ color/colorPrimary" android: textStyle = "bold"/> <ImageView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: scaleType = "centerCrop" android: padding = "5dip" android: src = "@ drawable/ic_dance_group" android: layout_gravity = "center_horizontal"/> </LinearLayout>

Add the following method to the Activity class to implement positioning:

 private Bitmap getViewBitmap(View addViewContent) {        addViewContent.setDrawingCacheEnabled(true);        addViewContent.measure(                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));        addViewContent.layout(0, 0,                addViewContent.getMeasuredWidth(),                addViewContent.getMeasuredHeight());        addViewContent.buildDrawingCache();        Bitmap cacheBitmap = addViewContent.getDrawingCache();        Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);        return bitmap;    }

 

Then, in the monitored class, convert the XML file View in the morning layout to Bitmap. The conversion process is as follows:

TextView dance_name;
LayoutInflater factory;... ....factory = LayoutInflater.from(MainActivity.this);view11 = factory.inflate(R.layout.video_camera,null);
dance_name = (TextView)view11.findViewById(R.id.dancegroup_place_name);dance_name.setText(place[num % 4]);BitmapDescriptor bdB = BitmapDescriptorFactory.fromBitmap(getViewBitmap(view11));

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.