I am creating a signed APK for the next update of my app. But when i transfer this APK file to my devices and install it, it crashes on opening the app.
Here is my project level gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
allprojects {
repositories {
jcenter()
}
}
And here is my module gradle file code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.washkart.activities"
minSdkVersion 15
targetSdkVersion 19
// Enabling multidex support.
multiDexEnabled true
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile files('libs/joda-time-2.4.jar')
compile(name:'acra-4.7.0', ext:'aar')
compile project(':ViewPagerIndicator')
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
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.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
And i have added below lines in my proguard file to avoid the warning/error which i got durng signing the APK:
-keepnames class org.apache.** {*;}
-keep class org.apache.** {*;}
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.app.** { *; }
-dontnote android.support.v4.**
-keep class org.joda.time.** { *; }
-keep interface org.joda.time.** { *;}
-keep class android.support.v7.app.** { *; }
-keep interface android.support.v7.app.** { *; }
-dontskipnonpubliclibraryclassmembers
-dontwarn org.apache.commons.logging.LogFactory
-dontwarn org.apache.http.annotation.ThreadSafe
-dontwarn org.apache.http.annotation.Immutable
-dontwarn org.apache.http.annotation.NotThreadSafe
-dontwarn org.jodatime.time.**
-dontwarn org.joda.convert.**
-dontwarn org.apache.http.**
-dontwarn android.net.**
I have android studio 1.5.1 and testing on Android 4.4.2. And the procedure which i used to generate in Build>Generate Signed APK>Selecting the module from dropdown > Add keystore file, alias and password> Build type = release > finish