[英]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” “ 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.