Arcgis4android 2: Multiple Android module sharing jar and so files

Source: Internet
Author: User

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

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.