Windwaker
Windwaker

Reputation: 111

Dependency handling for Android project in IntelliJ IDEA

I'm having trouble using external libs with a Android project I'm working on. I'm trying to use the Support Library v7 and a couple other libraries. I put the jar files in the 'libs' folder and right clicked on them and clicked Add Library....

The project is compiling fine but when I make and run it a NoClassDefFoundError is thrown.

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 936

Answers (1)

hgoebl
hgoebl

Reputation: 13007

It is not enough to include the jar.

You should import the v7-compat as a library project and when asked for the package name tell IntelliJ to use android.support.v7.appcompat. Take care that the manifest looks more or less like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.support.v7.appcompat">
    <uses-sdk android:minSdkVersion="7"/>
    <application />
</manifest>

After importing the Android-Library project it might be necessary to reload the whole project.

If you still have problems, compare your appcompat-library *.iml file with this file

Upvotes: 2

Related Questions