Android Studio (hereinafter referred to as) is Google's recommended Android-specific IDE, replacing the current mainstream eclipse, and ArcGIS also as the recommended Android IDE
This article does not describe the deployment of the Android SDK and the installation of AS
The following website should be the official China website of AS, there are many as related basic tutorials and as download (no FQ download), highly recommended
http://www.android-studio.org/
This code is based on Arcgis-android-sdk-v10.2.4\samples\maps\helloworld in the ArcGIS Android SDK
Environment: Android SDK API 19,android Studio 1.0,arcgis Android SDK 10.2.4, Xiaomi 4+MIUI V6
First new project, always next.
After you create a new project, switch it to project
Open the following file
Change the code to
1 PackageJls.as7;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 ImportAndroid.view.Menu;6 ImportAndroid.view.MenuItem;7 8 ImportCom.esri.android.map.MapView;9 Ten One Public classMainactivityextendsActivity { A Mapview Mmapview; - - @Override the protected voidonCreate (Bundle savedinstancestate) { - Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.activity_main); - + //After the content of this Activity are set, the map can be accessed programmatically from the layout. -Mmapview =(Mapview) Findviewbyid (r.id.map); + } A at @Override - protected voidOnPause () { - Super. OnPause (); - - //Call Mapview.pause to suspend map rendering and the activity is paused, which can save battery usage. - if(Mmapview! =NULL) in { - mmapview.pause (); to } + } - the @Override * protected voidOnresume () { $ Super. Onresume ();Panax Notoginseng - //Call Mapview.unpause to resume map rendering when the activity returns to the foreground. the if(Mmapview! =NULL) + { A mmapview.unpause (); the } + } -}
Open the Zip package for the ArcGIS Android SDK, and under the Libs directory, find the following jar packages
Copy to the following directory in the code
Also under the Libs directory of the ArcGIS SDK, put the following folders
Copy the following directory to the code (the Jnilibs directory does not exist by default and will be created manually)
Open Androidmanifest.xml, under the Manifest node, add the following:
<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"/>
Open the Moudle build.gradle and add the following code under the Android node
packagingoptions {
Exclude ' meta-inf/lgpl2.1 '
Exclude ' meta-inf/license '
Exclude ' meta-inf/notice '
}
After this configuration, plug in the phone, run the program
Deploy and HelloWorld with the development environment of Android Studio with ArcGIS Android SDK