I have successfully created an android application using android studio, and works fine when i run into android emulator or device connected to the development machine, but when i try to install the apk from build/outputs/apk the application crashes on opening.Also i tried to generate signed apk from android studio from build -> Generate signed apk (both release and debug) but it fails to generate the apk with the following error:
Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/Identifier;
My build.gradle
file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.aitrich.android.modern.photo"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.greenrobot.greendao'
ext {
supportLibraryVersion = '25.0.1'
playServicesVersion = '9.0.2'
retrofitVersion = '2.1.0'
}
greendao {
schemaVersion 1
}
apt {
arguments {
stagGeneratedPackageName "com.aitrich.android.modern.stag.generated"
stagDebug true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:support-v13:$supportLibraryVersion"
compile "com.android.support:cardview-v7:$supportLibraryVersion"
compile 'org.greenrobot:eventbus:3.0.0'
compile 'org.greenrobot:greendao:3.2.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.vimeo.stag:stag-library:2.0.2'
compile 'com.github.hotchemi:permissionsdispatcher:2.2.0'
compile 'com.tapadoo.android:alerter:1.0.6'
compile 'ch.halcyon:squareprogressbar:1.6.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.yalantis:ucrop:2.2.0-native'
compile 'com.evernote:android-job:1.1.8'
compile('com.github.silvestrpredko:dot-progress-bar:1.1') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile('com.github.StevenDXC:DxLoadingButton:1.5') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile('com.redmadrobot:chronos:1.0.7') {
exclude module: 'eventbus:2.4.0'
}
compile ('co.infinum:materialdatetimepicker-support:3.1.3') {
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v13'
}
compile 'com.android.support:multidex:1.0.1'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
apt 'com.vimeo.stag:stag-library-compiler:2.0.2'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.2.0'
}