Add library in Android Studio 0.2.8

旧城冷巷雨未停 提交于 2020-02-25 05:20:07

问题


Hello I'm still a real beginner, and I'd need to add a library to my project in android studio, from the answers I've seen on the web, you should go in file - project structure - modules. When I open project structure I only have platform settings - android sdk as option.

Has anything changed from the first versions?

thanks


回答1:


Just follow the few steps to add library files in android studio.

1)In Explorer, Click Project -> app -> libs -> (paste your jar file).

2)In Explorer, Click Android -> Gradle Scripts -> build.gradle(Module:app)[Double click it].

3)In the Dependencies { } add the following code

compile files('libs/your file name.jar')

4) Build and clean the project .

Now your jar file is successfully added.




回答2:


You should go in file - project structure - modules.. this is correct. At the top of the second column, click the + sign and select New module if you are creating a new library from scratch or Import module if you already have the library.




回答3:


In Android Studio 0.2.10, this workaround seems to work for me:

Step 1: Select Project > Right Click > Open Module Settings (F12) > Projects Settings > Click Modules.

Step 2: Click your Project > you will see 3 tabs : Sources/Path/Dependencies. Step 3 : Select Dependencies tab. You will see green '+' button to the right of 'Scope' title. Click on this and it will allow you to add Jars and libs.

PS: make the scope of the added jars/libs as Compile



来源:https://stackoverflow.com/questions/18793019/add-library-in-android-studio-0-2-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!