简体   繁体   English

如何将外部库 jar 添加到 Android Studio 1.3 项目的“外部库”部分?

[英]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.试图从优秀的 Eclipse 迁移到 Android Studio 1.3,但令人沮丧。

How does one add an external library jar to 'External Libraries' section of the project?如何将外部库 jar 添加到项目的“外部库”部分?

在此处输入图片说明

Reading SO posts including here , I went to File|Project Structure|Modules selected app and Dependencies tab.阅读包括此处在内的 SO 帖子,我转到文件|项目结构|模块选择的应用程序和依赖项选项卡。 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?它会在下面的屏幕截图中显示禁用主页图标时如何从 D:\\mylibs 添加 jar 文件的选择路径?

在此处输入图片说明

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.添加 .jar 文件的 AS 1.3 对话框有问题。 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.相反,要添加库,请在资源管理器 (Windows) 中选择 .jar 文件,右键单击它,选择复制,转到 Android Studio,选择 Project->[NameOfYourApp]->app->libs 并右键单击 libs 和将文件粘贴到其中,在确认框中单击“确定”。 Then, right click on the .jar file, go toward the bottom of the menu and select Add As Library.然后,右键单击 .jar 文件,转到菜单底部并选择添加为库。 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. Gradle 然后会自动将其添加到构建依赖项中。 You can then check the build.gradle file to make sure you see this line: compile files('libs/[filename].jar') under the dependencies section.然后,您可以检查 build.gradle 文件以确保您在依赖项部分下看到以下行:compile files('libs/[filename].jar')。

Click on your project name on the project explorer, press "F4" or right-click on the name and select "Open Module Settings".在项目资源管理器上单击您的项目名称,按“F4”或右键单击名称并选择“打开模块设置”。 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.然后点击“Dependencies”选项卡,然后点击右侧绿色的“+”按钮,然后选择“File Dependency”,这会弹出一个浏览窗口,用它打开“.jar”或“.aar” “ 文件。

Follow the next process and you should get it:按照下一个过程,你应该得到它:

复制“.jar”文件

打开“应用程序”文件夹

打开“libs”文件夹

过去的“.jar”文件

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

单击“依赖项”选项卡

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 要在Android Studio项目中添加外部库(而不是jar),我是否需要添加其他第一个首先引用的库(.jar)? - To add an external library(not jar) in Android Studio project do i need to add other libraries(.jar ones) that first one is referencing before hand? 如何在 Android Studio 的外部库中添加一个 jar? - How to add a jar in External Libraries in Android Studio? 在android studio中创建JAR时,如何在模块中添加外部jar库? - On creating a JAR in android studio, how to add the external jar library in the module? 如何从命令行向android项目添加外部jar库 - How to add external jar libraries to an android project from the command line 如何将外部 jar 库文件添加到 Intellij Idea android 项目 - How to add external jar library file to Intellij Idea android project 如何在Android Studio中的jar中更新外部库 - How to update an external library in a jar in Android Studio 如何将Android库项目转换为外部JAR? - How to Convert an Android Library Project to an External JAR? 将外部库添加到android studio 0.5.1项目中 - Add external library into android studio 0.5.1 project 无法将外部库添加到android studio项目 - Cannot add external library to android studio project 如何在Android Studio Project中添加外部C ++库? - How to add external C++ library in Android Studio Project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM