Android Studio uses the Instagram ig-gson-parse class library configuration

Source: Internet
Author: User

JSON is now popular Universal data format, Android is not very convenient for its operation, although there are Gson and other Lib.instagram new Ig-json-parse automated operation, automatic serialization and deserialization, very convenient.

Is that the official did not use studio, configure the operation cost me some time. Now share the successful configuration file, the Build.gradle (project build file under the non-root directory) in the app directory to add the following configuration information:

Apply plugin: ' Com.android.application 'ext { generatedsourcesdir = File ("Gen-src/main/java" )}repositories {mavencentral ()}android {compilesdkversion11buildtoolsversion"20.0.0"Defaultconfig {ApplicationID"XXXXXX"minsdkversion11targetsdkversion11    }Sourcesets {main {java { srcdir generatedsourcesdir } }} buildtypes {release {Runproguardfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' proguard-rules.txt '}}}dependencies {compile Filetree (dir:' Libs ', include: ' *.jar ')compile ' com.instagram:ig-json-parser-processor:0.0.4+ '}Tasks.withtype (javacompile) {dofirst { //Regenerate All Files if (generatedsourcesdir.exists ()) {Generatedsourcesdir.deletedir ()} Generatedsourcesdir.mkdirs ()} Options.compilerargs + = ['-processor ', ' Com.instagram. Common.json.annotation.processor.JsonAnnotationProcessor ', '-s ', Generatedsourcesdir]}

Then click on the button to compile, will automatically generate helper class, parsing and serialization work.

Refer to GitHub's official instructions for how to use the specific library.

Https://github.com/Instagram/ig-json-parser

Android Studio uses the Instagram ig-gson-parse class library configuration

Related Article

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.