没有检测JAR库 [英] JAR libraries not being detected

查看:235
本文介绍了没有检测JAR库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建Android Studio中一个新的项目,该项目使用外部库(JAR)。我把这个模块的的build.gradle:

I created a fresh project in Android Studio which uses external library (JAR). I put this in modules's build.gradle:

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('libs/mylib.jar')
}

不过,使用Android Studio编辑器时,它说,有我的code和标志的进口和变量(使用这个库)的一些错误。它不建立正确的说,它无法找到一个或另一个类。然而,当我去项目的目录在终端执行 gradlew 手动,它生成APK和它(APK)安装和工作就好了。

But, when using Android Studio editor, it says there are some errors in my code and marks imports and variables (which use this library). It doesn't build properly saying that it cannot find one or another class. However, when I go to project's directory in terminal and execute gradlew manually, it builds APK and it (the APK) install and works just fine.

我在想什么?是否有它用于检测库在我的项目中的任何其他设置?

What am I missing? Is there any another setting in my project which is used for library detection?

推荐答案

Android的工作室目前不会自动同步您的摇篮建立与Android工作室(.iml)文件的文件。但是,版本0.1.3增加了一个新的同步按钮,工具栏,将手动完成。

Android Studio currently does not automatically sync your Gradle build files with your Android Studio (.iml) files. However, version 0.1.3 added a new sync button to the toolbar that will do this manually.

它在这个博客帖子

有分别在摇篮项目大量进口修复和建设
  区域。现在有这将重新导入工具栏上的同步按钮
  该项目摇篮状态变成你的Andr​​oid Studio项目。用这个
  编辑摇篮文件,例如后添加库。在里面
  今后我们将更多的自动处理状态同步,但现在
  这是保持在IDE了解最新的项目的最简单的方法
  结构的变化对摇篮文件的。

There were a lot of fixes in the Gradle project import and build areas. There is now a "sync" button in the toolbar which will reimport the Gradle project state into your Android Studio project. Use this after editing your Gradle files, for example to add a library. In the future we will more automatically handle state syncing, but for now this is the simplest way to keep the IDE up to date with project structure changes made to the Gradle files.

这篇关于没有检测JAR库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆