ArcGIS Runtime SDK for Android Development note-Build an ArcGIS Android development environment based on Android Studio (offline Deployment)

Source: Internet
Author: User


1. Preface


In the previous article we introduced the basic process of building an ArcGIS Runtime SDK for Android development environment based on Android Studio, in which we used the Gradle-based approach to build, in this way primarily by setting up the MAVEN warehouse location , set compilation options, dependent versions to download the corresponding SDK dependency package in a networked environment.



But in the case of poor network situation this way is not, how to solve in the offline environment or intranet environment to implement the development process? There are two ways to learn about the present:



1) Configure the Intranet environment Maven warehouse, pre-cache to the intranet environment, and then call offline.



2) using direct Copy reference method, copy jar package, so library to corresponding third-party library support location, directly call to use.



These two ways each have their own merits and demerits, to see the specific use of the scene, here we mainly introduce the second copy of the method of reference.


Reprint Please specify the Source:  http://www.cnblogs.com/gis-luq/p/4760377.html




2. Offline deployment process 2.1, download the ArcGIS Runtime SDK for Android SDK package


1) Log in to the ArcGIS Runtime SDK for Android Developer Resource Center.









2) Click the download button and download the corresponding SDK package on the download page.








2.2, copy the relevant support function library to specify the corresponding location of the project and add a reference


1) Unzip the downloaded Zip package, the SDK package contains the following content:




among them, the following items are more important: 1 , doc--the API documentation for this version of the SDK, the official website is always up-to-date, you need to see the old API or the specific version of the API description of the general needs to find here 2, Lib-project--aar format of the function library, for example: ARCGIS-ANDROID-V10. 2.6-2 . AAR 3 , Libs--jar and so format libraries, typically copied to the project folder in the project, can be referenced for offline deployment 4 , samples--the sample code. All official sample code is here, the new version based on the Android Studio development environment Other instructions: SDK package download and description can also refer to blog http://www.cnblogs.com/gis-luq/p/ 4735815.html

 


2) Open the Lib folder in the SDK package, copy the jar package to the project's Lib folder under the






Will Libs in: Arcgis-android-api.jar, Arcgis-android-app-toolkit.jar, Jackson-core-1.9.5.jar, Jackson-mapper-1.9.5.jar, Jcifs-1.3.17.jar This 5 jar package is copied to the new Android project HELLOMAP2: Under the/app/libs folder






3) in the project: Create the Jnilibs folder under the/java/main folder and copy the Armeabi, armeabi-v7a, and x86 three folders to the Jnilibs folder.



Description: Actually here about how to configure Java Access so library in Android studio there are several ways, there are related to the online blog, here I was selected I think the simplest one to do the test, and test OK, so in this way. Other methods have not been measured for the time being

 2.3. Adding UI and code information 


1) Add Mapview component in Layout file Activity_main.xml


 <com.esri.android.map.MapView
        android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent">
    </com.esri.android.map.MapView>





Here we notice that the environment does not recognize the Com.esri.android.map.MapView class and suggests an exception. Toggle item Display as project.





After selecting the item App/libs/arcgis-android-api.jar right-click to set the Add as Library, after adding "Can't find Com.esri.android.map.MapView class" problem is gone.






At the same time we look at the Build.gradle under the app and find that we have added a compile option, which we can add directly here in code.






2) Add code information, implement Mapview UI and code binding, add a layer and display it


Null
This. Mapview = (mapview)This.findviewbyid (r.id.  map);  Set UI and Code bindings
String strmapurl="Http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer"; New Arcgistiledmapservicelayer (Strmapurl); This. Mapview.addlayer (Arcgistiledmapservicelayer); 




2.4. Set Application Permissions


Almost all applications for ArcGIS Android apps require network support, and some applications may require access to the device's sdcard, which requires read and write access to the card, and in addition to the most commonly used function for GIS is positioning, and the application should have location rights. Mapview for ArcGIS Android apps uses opengl2.x, so you'll need to add OpenGL support to the Android app's profile Androidmanifest.xml. Therefore, the applied configuration file contains at least the following configuration information:


   <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    
    <uses-feature    
        android:glEsVersion="0x00020000" android:required="true" />




2.5. Compiling and running the application


After running directly, we also found a bug that prompted the need to ignore the license information in the packaging option.






Open Build.gradle (Module:app) setting exclusions related information


 
 
 packagingOptions {
        exclude ‘META-INF/LGPL2.1‘
        exclude ‘META-INF/LICENSE‘
        exclude ‘META-INF/NOTICE‘
    }





Run the compilation again, the program passes






ArcGIS Runtime SDK for Android Development note-Build an ArcGIS Android development environment based on Android Studio (offline Deployment)


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.