Skip to content Skip to sidebar Skip to footer

Illegal Argument Exception When Adding External Library To Android Studio

I created four libraries in Eclipse that are interdependent. When I add the libraries to my Android project, I get the exception below. After going through a process of elimination

Solution 1:

repositories {
    flatDir {
        dirs'libs'
    }
}

try adding this to your app/gradle. and then do a rebuild.

If this is not working then you have to check your jar file's

  • read this for understanding your problem
  • read this for declaring default version for the dependency

Solution 2:

I recommend to search for the specific exception line (mostly the first one).

I think this link will help you solve the problem

https://stackoverflow.com/a/38503845/7147289

Solution 3:

You have not enabled multidex, Try adding below code to support multidexing and check

Modify your build.gradle:

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14//lower than 14 doesn't support multidex
             targetSdkVersion 22// Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    compile 'com.android.support:multidex:1.0.3'
}

Post a Comment for "Illegal Argument Exception When Adding External Library To Android Studio"