Sorry , I forgot the password for GitHub.It has been bothering me for a long time.Here is all my code:
this is mainActivity.java:
-------------------------------------------------------------------------------------------------------------------------------------
public class MainActivity extends AppCompatActivity {
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView=(MapView)findViewById(R.id.mapview);
}
}
this is module build.gradle:
--------------------------------------------------------------------------------------------------------------------------------------
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
packagingOptions{
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
defaultConfig {
applicationId "com.example.hjy.testmapview"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// sourceSets {
// main {
// jniLibs.srcDirs = ['libs']
// }
// }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.esri.arcgis.android:arcgis-android:10.2.8'
// compile files('libs/arcgis-android-api.jar')
// compile files('libs/gson-2.3.1.jar')
}
this is project build.gradle:
--------------------------------------------------------------------------------------------------------------------------------------------------------------
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'http://dl.bintray.com/esri/arcgis'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
this is main.xml:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hjy.testmapview.MainActivity">
<com.esri.arcgisruntime.mapping.view.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>