Weex-amap is a weeX autoramap plug-in, from the perspective of the client is actually some WEEX component and Module extension, through weeX bridge to use the native end of map positioning, mapping and other functions.

Documents: github.com/weex-plugin…

1. Access to Android terminal

1. Preconditions

Amap SDK

Autonavi’s official document is to let users directly introduce JAR packages into the project, but someone in the group’s warehouse has uploaded the corresponding JAR packages. Gradle dependencies are available:

Compile files('libs/ amap_location_v3.00_20160922.jar ') compile 'com.amap. API :3dmap:5.4.0' compile 'com. Amap. API: location: 3.6.1'Copy the code

weex

Due to the WEEx SDK has some problems (the problems encountered will be described below), the final use is:

/ / weex compile 'com. Taobao. Android: weex_sdk: 0.16.2.11 @ aar'Copy the code

2. Introduce WEEX-AMAP

Introduction of depend on

The compile 'com. Taobao. Android: weexplugin - loader: 1.0.2' compile 'com. Taobao. Android: weex_amap: hundreds of' the compile 'com. Alibaba. Weex. Plugin: annotation: 1.0.11'Copy the code

Mainly weeX-AMAP package, including extended components; The Annotation pack is WEEX’s annotation support; The Weexplugin-loader package automatically registers annotated components and modules to weeX Engine.

Initialize the

. // Aliweex initialization and custom component registration... / / in weex initialization after load the annotation component WeexPluginContainer. LoadAll (this);Copy the code

If you don’t want to use the Plugin Loader, you can also use the registerModule or registerComponent of WXSDKEngine.

Basically completing these steps completes weeX-AMAP support on the native side. To access WEEX-AMAP, you need to import the WEEX-AMAP plug-in package and register the WEEX Module and WEEX component of the plug-in package with WEEX.

Second, the pit

Description: A WXMapViewComponent NoClassDefFoundError problem occurs when several JAR packages are introduced. Cause: Multi dex Problem solved: The configuration project supports multidex

Description: Broken lines, circles and other effects are not shown

However, running weeX-AMAP official demo with the official WEEX demo did not cause this problem.Copy the code

Cause: Error rendering weex-AMAP label

The weeX SDK 0.13.0.3 is a bugCopy the code

Solution: Upgrade weex-SDK version to 0.16.2.11 (cloud corruption also access this plug-in, using this version)

Description: component color attribute does not take effect reason and solution: Android requires the color code must be standard, front-end can not use ‘# FFF ‘incomplete or ‘RGB(66,66,66)’

Description: Marker and other components click events are invalid cause: There is no onClick event monitoring set inside marker component