I have an app that has as minSdkVersion API 16, When I added new jar files activation, additionnal, mail, itextpdf for sending pdf file throw email. Its throwing exception below for previously added module library:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.viewpagerindicator.TabPageIndicator" on path: DexPathList[[zip file "/data/app/com.inbridge.avakaash-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.inbridge.avakaash-1, /vendor/lib, /system/lib]]
If I remove these new jar files then its working fine...
this is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.inbridge.avakaash"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile project(':payUMoneysdk')
compile files('libs/httpclient-win-4.4.1.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/gcm.jar')
compile 'com.android.support:appcompat-v7:23.0.0-alpha2'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile files('libs/itextpdf-5.5.9.jar')
compile 'com.android.support:multidex:1.0.1'
}
This is my settings.gradle
include ':library'
include ':payUMoneysdk'
include ':avakaash'
Please any one help me to resolve this error...
The problem is that multiDexEnabled true
in not enough when you're targeting devices older than 5.0 Lollipop. If you want to support KitKat and older then in addition to this flag, you also have to deploy the secondary dexes make your main Application
class, as explained in the official docs.
There are multiple ways to do this:
You can make your your Application
class extend from MultiDexApplication
public class MyApplication extends MultiDexApplication {
You can add the following lines to your Application
class:
public void onCreate(Bundle arguments) {
MultiDex.install(getTargetContext());
super.onCreate(arguments);
}
If you don't use a custom Application
class, you can enable it via the AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<application
...
android:name="android.support.multidex.MultiDexApplication">
</application>
</manifest>