Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a library Android-studio

I'm having trouble when i add achartengine-1.1.0.jar in my project. When i add

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

in build.gradle, Gradle shows the following message :

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.

Thanks in advance. Fab.

like image 995
Fabr9193 Avatar asked Oct 04 '13 08:10

Fabr9193


People also ask

How do I create a library project in android Studio?

Using library projects helps you to structure your application code. To create a new library module in Android Studio, select File New Module and select Android Library .

Where is the library in android Studio?

The android default libraries like appcompact, design support libraries are stored in your folder where you have installed the SDK, precisely <SDK FOLDER>/extras/android/m2repository/com/android . The 3rd party libraries are stored in . gradle/caches/modules-2/files-2.1 folder.

How do I add library dependencies?

To add a dependency on a library that is an annotation processor, you must add it to the annotation processor classpath using the annotationProcessor configuration. That's because using this configuration improves build performance by separating the compile classpath from the annotation processor classpath.

What are libraries in android Studio?

Android App Development for Beginners The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level.


1 Answers

The dependency should read compile files(...), not compile file(...). Also in the above you write the path as libs.achartengine-1.1.0.jar, this should be libs/achartengine-1.1.0.jar.

like image 87
Sofi Software LLC Avatar answered Sep 26 '22 01:09

Sofi Software LLC