Beginner Java and Android, simple learning history record, do not spray.
Android Studio A solution that has multiple module shared jar and so files under project to resolve duplication issues.
1. Multiple repeated references to Libs and so file issues
Android Studio under Project has multiple module cases, previously referencing common jar packages and so files, which are copied under each module.
As a result, there are too many duplicate files and a large volume.
The things in boxes 1 and 2 are duplicates.
2. Create a new public directory
Create a new libs and Jnilibs directory under project (you can also customize the name) to place the common parts.
and the jar package and so package into the two directories (a directory can also, two more easily distinguish between different types of use).
:
3. Modifying references
Modify the reference address in the Build.gradle of each module.
Sourcesets: Specify so file location
Depencies: Specifying a dependent jar location
HelloWorld the contents of the Build.gradle file.
Apply plugin: ' Com.android.application 'Android {compilesdkversion23buildtoolsversion' 23.0.1 'Defaultconfig {minsdkversion19targetsdkversion23Versioncode1Versionname"1.0"} packagingoptions{exclude' meta-inf/lgpl2.1 'Exclude' Meta-inf/license 'Exclude' Meta-inf/notice '} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' proguard-rules.txt ' } }//Specify locationsourcesets{main{jnilibs.srcdirs=['. /jnilibs ']; } }}//Specify a dependent jar package locationDependencies {//Module Dependency//compile ' com.esri.arcgis.android:arcgis-android:10.2.5 '//Local binary dependencyCompile files ('.. /libs/jcifs-1.3.17.jar ') compile files (‘.. /libs/arcgis-android-api.jar ') compile files (‘.. /libs/arcgis-android-app-toolkit.jar ') compile files (‘.. /libs/jackson-core-1.9.5.jar ') compile files (‘.. /libs/jackson-mapper-1.9.5.jar ')}
Build.gradle
Arcgis4android 2: Multiple Android module sharing jar and so files