Android Studio: Add jar as library?

后端 未结 30 2425
天命终不由人
天命终不由人 2020-11-21 05:54

I\'m trying to use the new Android Studio but I can\'t seem to get it working correctly.

I\'m using the Gson library to serialize/deserialize JSON-o

30条回答
  •  忘了有多久
    2020-11-21 06:42

    I found Dependency Manager of Android Studio quite handy and powerful for managing 3rd party dependencies (like gson mentioned here). Providing step by step guide which worked for me (NOTE: These steps are tested for Android Studio 1.6 and onward versions on Windows platform).

    Step-1: Goto "Build > Edit Libraries and Dependencies..." it would open up the dialog "Project Structure"

    Step-2: Select "app" and then select "Dependencies" tab. Then select "Add > 1 Library dependency"

    Step-3: "Choose Library Dependency" dialog would be shown, specify "gson" in search and press the "search button"

    Step-4: The desired dependency would be shown in search list, select com.google.code.gson:gson:2.7 (this is the latest version at the time when I wrote the answer), press OK

    Press OK on "Project Structure" dialog. Gradle would update your build scripts accordingly.

    Hope this would help :)

提交回复
热议问题