2

I make one project like below structure

enter image description here

my build.gradel file as below

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "pkg.com.appname"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
 }

I tried all possibility as per current accepted answer like below

1. Comment dependency lib line form build.gradle

dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
 }

but if i remove this than in my class file getting error like your library is missing for this class

2. By making change line as compile to provided

when i making above change than my application not run and give message like like null pointer due to library not getting to respective class.

So i m getting confuse which way i follow for this any idea how can i solve this problem? your all suggestions are appreciable.

1 Answers1

0

In defaultConfig add :

multiDexEnabled = true

And in same build.gradle add :

dexOptions {
    javaMaxHeapSize "4g"
}

And in dependencies add :

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'}
  • Android Weblineindia : Hi Thanks....After adding multiDexEnabled = true resolve multiDex exception but at loading time many class file not generate so its throw error classDefNotFound. how can i resolve this? –  Aug 06 '15 at 05:01
  • While i am adding this dependency its at run time throw exception classDefNotfoun `compile 'com.google.api-client:google-api-client:1.20.0'` `compile 'com.google.api-client:google-api-client-android:1.20.0'` `compile 'com.google.api-client:google-api-client-gson:1.20.0'` `compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'` `compile 'com.google.android.gms:play-services:7.5.0'` –  Aug 06 '15 at 05:27