I'm using Android API 23
and org.apache.http.legacy
so I can use Volley
. Everything works except when I use proguard
. I'm getting this error:
Error:Execution failed for task ':app:packageDevRelease'. Unable to compute hash of ...app/build/intermediates/classes-proguard/dev/release/classes.jar
My gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.jakewharton.hugo'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'io.fabric.tools:gradle:1.+'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "..."
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.0.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
abortOnError false
disable 'InvalidPackage'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
...
}
productFlavors {
...
}
}
dependencies {
compile files('libs/org.apache.http.legacy.jar')
// #### Submodules
compile project(':submodules:volley')
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:percent:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.google.code.gson:gson:2.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile "com.daimajia.swipelayout:library:1.2.0@aar"
compile 'com.kbeanie:image-chooser-library:1.5.2@aar'
compile 'com.mcxiaoke.viewpagerindicator:library:2.4.1@aar'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
}
EDIT:
Added this lines to proguard
has mentioned in this post:
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.google.android.gms.**
-dontwarn com.android.volley.toolbox.**
I get the same error but now with some friendly output:
Unexpected failure during lint analysis of BaseClient.java (this is a bug in lint or one of the libraries it depends on) TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) :app:validateExternalOverrideSigning :app:packageDevRelease FAILED
My BaseClient.java has some methods like this:
public static <T extends Object, U extends Object> void executePostRequest(
String url,
T requestPayload,
Class<U> responseClass,
Response.Listener<U> successListener,
Response.ErrorListener errorListener){}
and
private static <T> BaseRequest.AuthRetryListener<T> createAuthRequestListener()
etc...
How can I make this work?
Thanks.
EDIT 2:
User ajcpsoares -ignorewarnings
solution works. I'll leave this link from ProGuard Troubleshooting docs. Also, since in my opinion this is a workaround instead of a solution I'll leave here the Android Open Source Project - Issue Tracker link too.