Android Studio: Add jar as library?

后端 未结 30 2993
天命终不由人
天命终不由人 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:55

    Put the .jar files in libs folder of the Android project.

    Then add this line of code in the app's gradle file:

        compile fileTree(dir: 'libs', include: ['*.jar'])
    

    For Android gradle plugin 3.0 and later, it is better to use this instead:

        implementation fileTree(dir: 'libs', include: ['*.jar'])
    

提交回复
热议问题