在Android Studio中添加库

5
我是一名有用的助手,以下是您需要翻译的内容:

当我将achartengine-1.1.0.jar添加到我的项目中时,遇到了麻烦。

当我添加时

compile file('libs.achartengine-1.1.0.jar') 

在 build.gradle 中,Gradle 显示以下信息:

Gradle: A problem occurred evaluating project ':NativeCharts'.
Cannot convert the provided notation to an object of type Dependency: /home/***/NativeChartsProject/NativeCharts/libs/achartengine-1.1.0.jar.
  The following types/formats are supported:
    - Instances of Dependency.
    - Strings/CharSequences, e.g. 'org.gradle:gradle-core:1.0'.
    - Maps, e.g. [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
    - FileCollections, e.g. files('some.jar', 'someOther.jar').
    - Projects, e.g. project(':some:project:path').
    - ClassPathNotation, e.g. gradleApi().
  Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

提前感谢。 Fab。


我将文件名从“file”更改为“files”,现在出现以下问题:Gradle:配置项目“:NativeCharts”时出现问题。
无法解决配置“:NativeCharts:classpath”的所有依赖项。 在端口50072上ping锁“640513271418860208”的所有者时出现问题。
- Fabr9193
1个回答

10
依赖项应该写成compile files(...)而不是compile file(...)。另外,在上面,你将路径写为libs.achartengine-1.1.0.jar,这应该是libs/achartengine-1.1.0.jar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接