简体   繁体   English

将roottools.jar导入Android Studio

[英]Importing roottools.jar into Android Studio

I'm trying to import roottools from here: https://code.google.com/p/roottools/ (jar file) to the Android Studio project. 我正在尝试从这里导入roottools: https//code.google.com/p/roottools/ (jar文件)到Android Studio项目。 So far I've tried the following: 到目前为止,我已经尝试了以下内容:

  • copy RootTools-javadoc-3.4.jar into libs directory under my project. 将RootTools-javadoc-3.4.jar复制到我项目下的libs目录中。
  • Add imports 添加进口
  • Reorganize imports. 重组进口。
  • Rebuild project 重建项目

But still I don't have "acces" to it's methods. 但我仍然没有“访问”它的方法。 Is it possible that is only compatible with Eclipse? 是否有可能仅与Eclipse兼容?

I tried using the JAR available for download and it didn't work either. 我尝试使用可供下载的JAR,它也没有用。 To get this working, I had to download the project available at github here . 为了得到这个工作,我不得不下载可在GitHub上的项目在这里 Compile and run the task "makeJar" (right click on task makeJar in the gradle.build and select run). 编译并运行任务“makeJar”(右键单击gradle.build中的任务 makeJar并选择run)。

I just added this new jar in the libs and referenced in the gradle.build file. 我刚刚在libs中添加了这个新jar,并在gradle.build文件中引用。

dependencies {
    ...
    compile files('libs/RootTools.jar')
}

or you can add it via Project Properties. 或者您可以通过项目属性添加它。

It worked perfectly (don't forget to sync your the gradle files if you edit it manually). 它工作得很好(如果您手动编辑,请不要忘记同步您的gradle文件)。

In your project, choose File menu > Project Structure (there's a bug in 0.4.4 and this menu item won't have a title at all; it still works) > Modules > choose your module > Dependencies > + button > File dependency > choose your library from the file picker. 在您的项目中,选择文件菜单> 项目结构 (0.4.4中有一个错误,此菜单项根本没有标题;它仍然有效)> 模块 >选择模块> 依赖项 > +按钮> 文件依赖项 >从文件选择器中选择您的库。 That file needs to be somewhere beneath the root directory of your projet; 该文件需要位于项目根目录下的某个位置; the libs directory is fine. libs目录没问题。

Screenshot of the Project Structure dialog: “项目结构”对话框的屏幕截图

项目结构显示模块>依赖关系>文件依赖关系

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

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