简体   繁体   中英

How does one add an external library jar to 'External Libraries' section of an Android Studio 1.3 project?

Trying to migrate to Android Studio 1.3 from good ol' Eclipse but it's frustrating.

How does one add an external library jar to 'External Libraries' section of the project?

在此处输入图片说明

Reading SO posts including here , I went to File|Project Structure|Modules selected app and Dependencies tab. Clicked '+'

It brings up the Select Path below How do I add a jar file from D:\\mylibs when the Home icon is disabled in the screenshot below?

在此处输入图片说明

I tried to copy the jars, and then right-click 'External Libraries' and Paste but it did not work.

There is something wrong with the AS 1.3 dialogue where you add the .jar file. There are no buttons to navigate up the directory tree or change drives. Instead, to add the library, select the .jar file in Explorer (Windows), right click on it, select Copy, go to Android Studio, select Project->[NameOfYourApp]->app->libs and right click on libs and Paste file into it, click Ok on the confirmation box. Then, right click on the .jar file, go toward the bottom of the menu and select Add As Library. Then in the Create Library box confirm that it is adding to app and click Ok. Gradle will then automatically add it to the build dependencies. You can then check the build.gradle file to make sure you see this line: compile files('libs/[filename].jar') under the dependencies section.

Click on your project name on the project explorer, press "F4" or right-click on the name and select "Open Module Settings". Then click on "Dependencies" tab, and click the green "+" button on the right side, then select "File Dependency", this will bring up a Browse Window, use it to open the ".jar" or the ".aar" file.

Follow the next process and you should get it:

复制“.jar”文件

打开“应用程序”文件夹

打开“libs”文件夹

过去的“.jar”文件

右键单击“应用程序”并选择“打开模块设置”或按“F4键”

单击“依赖项”选项卡

单击绿色“+”号并选择“文件依赖项”

浏览“libs”文件夹,选择“.jar”文件并点击“OK”按钮

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM