Applying proguard only for instrumentation apk - android

Hi I am using espresso to run my instrumentation testing.
I had added various testing related dependencies now when enabling proguard for debug build to check everything is fine.
I am getting proguard warnings related to the instrumentation apk.
Can anyone guide me how can I add proguard rules which Android Studio will use to generate my instrumentation apk.
Below is the stacktrace
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpHeaders: can't find referenced class com.fasterxml.jackson.databind.annotation.JsonSerialize
Warning: com.github.tomakehurst.wiremock.http.HttpHeaders: can't find referenced class com.fasterxml.jackson.databind.annotation.JsonDeserialize
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonProcessingException
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonProcessingException
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.HttpResponse
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.StatusLine
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.HttpResponse
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
below is the build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.aaa.bb"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug{
testCoverageEnabled true
minifyEnabled true
testProguardFile "test-proguard-rules.pro"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
testProguardFile('test-proguard-rules.pro')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions{
disable 'InvalidPackage'
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
def appDependencies = rootProject.ext.appDependencies;
def testDependencies = rootProject.ext.testDependencies
compile appDependencies.appCompact
compile appDependencies.perCent
compile appDependencies.design
compile appDependencies.recyclerView
compile appDependencies.butterKnife
compile appDependencies.eventBus
compile appDependencies.rxJava
compile appDependencies.materialDialog
compile appDependencies.rxAndroid
compile appDependencies.dagger
compile (appDependencies.materialDialog.toString()){
transitive true
}
compile appDependencies.retofit
compile appDependencies.retrofitGsonConverter
compile appDependencies.retrofitRxJavaAdapter
provided appDependencies.daggerCompiler
provided appDependencies.javaxAnnotation
///////////////// our projects ////////////
compile project(':pushnotification')
////////////////////////////////////////////
//////////// TDD //////////////////////////
testCompile testDependencies.jUnit
testCompile testDependencies.roboelectric
testCompile (testDependencies.assertJ.toString()){
exclude group:'com.android.support'
}
androidTestCompile testDependencies.espresso
androidTestCompile testDependencies.espressoIntent
androidTestCompile testDependencies.runner
androidTestCompile testDependencies.runnerRules
androidTestCompile testDependencies.mockito
androidTestCompile testDependencies.supportAnnotations
androidTestApt testDependencies.daggerCompiler
androidTestCompile files(testDependencies.wireMockJar)
androidTestCompile testDependencies.wmHttpClientAndroid
androidTestCompile testDependencies.wmLogging
androidTestCompile testDependencies.wmGuava
androidTestCompile testDependencies.wmJetty
androidTestCompile testDependencies.wmJackSonCore
androidTestCompile (testDependencies.wmJsonAssert) {
exclude group: 'org.json', module: 'json'
exclude group: 'commons-collections', module: 'commons-collections'
}
androidTestCompile testDependencies.wmXmlUnit
///////////////////////////////////////////////////////////////////
}
Below is the test-proguard-rule.pro
-dontobfuscate
-dontwarn

Related

minifyEnabled - true is not working in debug mode

minifyEnabled - true is not working for android in debug mode.I have to Obfuscate my Android Project.I have tried below links but none worked for me.
1.proguardRelease FAILED when compiling apk with assembleRelease in Android Studio
2.Proguard minifyEnabled true for debug build, not working on pre-Lollipop
Below is my application build gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'XX.XXX'
minSdkVersion 21
targetSdkVersion 23
versionCode 9
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':android-logging-log4j-1.0.3')
compile project(':log4j-1.2.17')
compile files('libs/gson-2.6.2.jar')
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
// compile 'com.viewpagerindicator:library:2.4.1#aar'
//compile files('libs/hellocharts-library-1.5.8.jar')
compile 'com.esri.arcgis.android:arcgis-android:10.2.8-1'
//GIS
compile(name:'ClientHubSLL-3.16.1', ext:'aar')
compile(name:'ClientLog-3.16.1', ext:'aar')
compile(name:'Common-3.16.1', ext:'aar')
compile(name:'Connectivity-3.16.1', ext:'aar')
compile(name:'CoreServices-3.16.1', ext:'aar')
compile(name:'DataVaultLib-3.16.1', ext:'aar')
compile(name:'E2ETrace-3.16.1', ext:'aar')
compile(name:'HttpConvAuthFlows-3.16.1', ext:'aar')
compile(name:'HttpConversation-3.16.1', ext:'aar')
compile(name:'MAFLogger-3.16.1', ext:'aar')
compile(name:'MAFLogonCore-3.16.1', ext:'aar')
compile(name:'ODataAPI-3.16.1', ext:'aar')
compile(name:'ODataOnline-3.16.1', ext:'aar')
compile(name:'Request-3.16.1', ext:'aar')
compile(name:'SupportabilityFacade-3.16.1', ext:'aar')
compile(name:'MAFCalendar-3.16.1', ext:'aar')
compile(name:'MAFLocaleAwareControls-3.16.1', ext:'aar')
compile(name:'MAFLogViewer-3.16.1', ext:'aar')
compile(name:'MAFSettingScreen-3.16.1', ext:'aar')
compile(name:'MAFTreeView-3.16.1', ext:'aar')
compile(name:'MAFUIComponents-3.16.1', ext:'aar')
compile(name:'XscriptParser-3.16.1', ext:'aar')
compile(name:'MAFLogonUI-3.16.1', ext:'aar')
compile(name:'MobilePlace-3.16.1', ext:'aar')
}
apply plugin: 'com.google.gms.google-services'
Exception
Warning:jcifs.http.NetworkExplorer: can't find superclass or interface javax.servlet.http.HttpServlet
Warning:jcifs.http.NtlmHttpFilter: can't find superclass or interface javax.servlet.Filter
Warning:jcifs.http.NtlmHttpServletRequest: can't find superclass or interface javax.servlet.http.HttpServletRequestWrapper
Warning:jcifs.http.NtlmServlet: can't find superclass or interface javax.servlet.http.HttpServlet
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServlet
Warning:jcifs.http.NetworkExplorer: can't find referenced method 'java.util.Enumeration getInitParameterNames()' in program class jcifs.http.NetworkExplorer
Warning:jcifs.http.NetworkExplorer: can't find referenced method 'java.lang.String getInitParameter(java.lang.String)' in program class jcifs.http.NetworkExplorer
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.ServletException
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.ServletOutputStream
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServlet
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.ServletOutputStream
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.ServletOutputStream
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NetworkExplorer: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterConfig
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterChain
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpServletRequest
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpServletResponse
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.Filter
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.ServletException
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterConfig
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterChain
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.http.HttpSession
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterConfig
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.ServletRequest
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.ServletResponse
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.FilterChain
Warning:jcifs.http.NtlmHttpFilter: can't find referenced class javax.servlet.ServletReq..................
Please help me on this.Thanks in advance.
Please, try this and use appropriate proguard rules for the libraries you are using. Proguard will obfuscate every class even from third party libraries, unless you set specific rules for those.
debug {
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Common proguard snippets:
https://github.com/krschultz/android-proguard-snippets
You say you are getting the following exception:
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'. > java.io.IOException: Please correct the above warnings first.
Proguard and Dexguard will obfuscate code and show a lot of warnings but that doesn't mean your app wont work. The problem is that with the default config the compilation will stop at every warning. However, most of the time ignoring these warnings is a reasonable option . To try this use the following command:
-ignorewarnings Specifies to print any warnings about unresolved references and other important problems, but to continue processing in
any case. Ignoring warnings can be dangerous. For instance, if the
unresolved classes or class members are indeed required for
processing, the processed code will not function properly. Only use
this option if you know what you're doing!
Or this if you want to specify classes or packages individually(better option):
-dontwarn [class_filter]
Specifies not to warn about unresolved references and other important problems at all. The optional filter is a regular expression; DexGuard doesn't print warnings about classes with matching names. Ignoring warnings can be dangerous. For instance, if the unresolved classes or class members are indeed required for processing, the processed code will not function properly. Only use this option if you know what you're doing!
This is not the best and/or final solution. Warnings can mean that your app is obfuscating classes that should be kept but at least with this you can run and see the errors later (Like for example ClassNotFoundException).
If this does not solve your problem try to get the stacktrace of the error with the following command added:
-verbose
Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
Add this to your proguard-rules.pro
-dontwarn javax.naming.**
-dontwarn javax.servlet.**
-dontwarn org.slf4j.**

gradle build error while generating signed apk

I have created an app ready to be uploaded om playstore. I have created Keystore password and all when the gradle builds I get the following error. This is the first time I am uploading an app on playstore. Below are the error and the build.gradle file...Please help me!!Any other information regarding uploading app is very helpful
Error:
Information:Gradle tasks [:app:assembleRelease]
Warning:okhttp3.Address: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Authenticator: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$2: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$CacheResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$Entry: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.CacheControl: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.CertificatePinner: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Challenge: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Connection: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionPool: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionSpec: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionSpec$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cookie: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Dispatcher: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.EventListener: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.FormBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Handshake: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Headers: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.HttpUrl: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.HttpUrl$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Interceptor$Chain: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MediaType: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody$Part: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.OkHttpClient: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.OkHttpClient$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Request: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Request$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$1: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$2: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$3: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Response: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Response$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ResponseBody$1: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Route: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.WebSocket: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.WebSocketListener: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.Util: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.CacheStrategy: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.DiskLruCache: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.DiskLruCache$Snapshot: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.connection.RealConnection: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.http.RealResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.ws.RealWebSocket: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.package-info: can't find referenced class javax.annotation.ParametersAreNonnullByDefault
Warning:okio.AsyncTimeout: can't find referenced class javax.annotation.Nullable
Warning:okio.Buffer: can't find referenced class javax.annotation.Nullable
Warning:okio.BufferedSource: can't find referenced class javax.annotation.Nullable
Warning:okio.ByteString: can't find referenced class javax.annotation.Nullable
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.HashingSink: can't find referenced class javax.annotation.Nullable
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio$4: can't find referenced class javax.annotation.Nullable
Warning:okio.RealBufferedSource: can't find referenced class javax.annotation.Nullable
Warning:okio.Segment: can't find referenced class javax.annotation.Nullable
Warning:okio.SegmentPool: can't find referenced class javax.annotation.Nullable
Warning:okio.package-info: can't find referenced class javax.annotation.ParametersAreNonnullByDefault
Warning:there were 181 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
Information:BUILD FAILED in 5m 31s
Information:1 error
Information:63 warnings
Information:See complete output in console
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.abcd.efgh"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:11.6.0'
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'
})
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.wdullaer:materialdatetimepicker:3.4.0'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You have minifyEnabled true for release and perhaps some needed classes for javax.annotation.Nullable are needed but are removed by minifying. If you don't need it for now you can just remove that tag for release. If you do need the flag you have to tinker and configure the minify to keep the class.
What this looks like to me is a transitive dependency issue. Just as you don't want to re-create the wheel and use gradle to import other code well the creaters of the gradle dependencies don't want to re-create the wheel ether so they used gradle too. You end up with nested dependencies that may not use the most recent version. In fact you even excluded group: 'com.android.support', module: 'support-annotations' in the androidtestcompile version to avoid a transitive dependency conflict. I feel your pain. I would go to the gradle tab and try running any task with dependency in the name. Its very verbose to track this type of error, the stack trace you listed will help. Running lint could also help clean up your code and as Yordan mentioned proguard is not required but it does add security by obfusicating the code

Getting Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. while generating signed apk

I'm trying to generate signed apk of my android app and the task is remaining unsuccessful giving me this error:
Information:Gradle tasks [:app:assembleRelease]
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.ThreeLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.StringHolder
Warning:com.mikepenz.fastadapter_extensions.items.TwoLineItem: can't find referenced class com.mikepenz.materialize.holder.ImageHolder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentSequencedCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpscLinkedQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscUnboundedArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.UnsafeAccess: can't find referenced class sun.misc.Unsafe
Warning:there were 145 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
Information:BUILD FAILED
Information:Total time: 19.342 secs
Information:1 error
Information:69 warnings
Information:See complete output in console
Here's my proguard-rules.pro file:
-keep public class com.mikepenz.fastadapter
-keep public class com.squareup.picasso
-keep public class rx.internal.util.unsafe
Here's build.gradle file:
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.abc.xxx"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "0.1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.mikepenz:fastadapter:1.8.2#aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.6#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.mikepenz:fastadapter-extensions:1.8.0#aar'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.firebase:geofire-android:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-invites:10.2.0'
compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
compile 'me.himanshusoni.chatmessageview:chat-message-view:1.0.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.firebaseui:firebase-ui:0.4.1'
compile 'pl.charmas.android:android-reactive-location:0.10#aar'
compile 'io.reactivex:rxjava:1.2.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-vector-drawable:25.0.0'
compile 'com.github.coyarzun89:fabtransitionactivity:0.2.0'
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
compile 'com.github.paolorotolo:appintro:4.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Why am I getting these warnings and error and how can I get rid of them?
I tried searching the web and read this doc here, but I'm still unable to figure out.
Please help me with this.
Your problem seems to include proguard exceptions for okhttp which is used by picasso. Add
# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
See here for proguard configuration for other libraries you might be using.
For
Warning:com.mikepenz.fastadapter_extensions.items.SingleLineItem:
Apply below Rule
-keep class com.mikepenz.materialize.holder.** { *; }
From Comment discussion #user1140237 it solved it for mikepenz library
but what about
Warning:rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeR‌​ef:
can't find referenced class sun.misc.Unsafe and related warnings?
Add below rule
-dontwarn sun.misc.Unsafe
-dontwarn com.google.common.collect.MinMaxPriorityQueue
Check this link it my help you
For ok http or square related follow the answer given by JohnWowUs

Android - Assertj Android - Run error

I´m trying to run assertj-android but it send an error. (it runs fine with junit 4)
My Dependencies:
dependencies {
testCompile 'junit:junit:4.12'
androidTestCompile ('com.squareup.assertj:assertj-android:1.0.0'){
exclude group:'com.android.support', module:'support-annotations'
}
}
My Build type:
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
My progard-rules.pro:
## Assertj
-dontwarn org.assertj.**
-keep class org.assertj.** {*;}
And I get this error on run:
:app:proguardDebugAndroidTest
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find superclass or interface org.junit.rules.TestRule
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find superclass or interface org.junit.runners.model.Statement
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.rules.TestRule
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runners.model.Statement
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runner.Description
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runners.model.Statement
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runner.Description
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.Statement
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.MultipleFailureException
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.Statement
Warning:org.assertj.core.internal.JavaBeanDescriptor: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.internal.PropertySupport: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.internal.cglib.core.DebuggingClassWriter$1: can't find referenced class org.assertj.core.internal.cglib.asm.util.TraceClassVisitor
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.IntrospectionException
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.Introspector
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.BeanInfo
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.BeanInfo
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.IntrospectionException
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.Introspector
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.BeanInfo
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.PropertyDescriptor
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.BeanInfo
Warning:org.assertj.core.util.xml.XmlStringPrettyFormatter: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning:there were 59 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardDebugAndroidTest FAILED
:app:newRelicDeinstrumentTask
[newrelic.info] Deinstrumenting...
Error:Execution failed for task ':app:proguardDebugAndroidTest'.
> java.io.IOException: Please correct the above warnings first.
Why?
Based on Proguard revision 1.2.0 and post in stackoverflow.
I needed to add testProguardFiles to my debug buildType because tests ignore proguardFiles attribute so it was ignoring my proguard setup:
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'"true"
}
}
And my proguard file:
## Assertj
-dontwarn org.assertj.core.**
-dontwarn org.junit.**
-dontwarn java.beans.**

Issue building apk file

I am working with an Application where I enabled runProguard true in my build.gradle file of my app. When I go for building signed apk I am getting warnings and build process failed.
Log File:
Warning:com.google.common.base.Absent: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Ascii: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.CaseFormat$StringConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.CharMatcher: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Converter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$ConverterComposition: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$FunctionBasedConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$ReverseConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Defaults: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Enums$StringConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence$EquivalentToPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence$Wrapper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.FinalizableReferenceQueue$FinalizerLoader: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Function: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.FunctionalEquivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$ConstantFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$ForMapWithDefault: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$FunctionComposition: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$FunctionForMapNoDefault: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$IdentityFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$PredicateFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$SupplierFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Joiner$1: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner$MapJoiner: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.MoreObjects: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.MoreObjects$ToStringHelper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Objects: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Objects: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Objects$ToStringHelper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Optional: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.PairwiseEquivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Preconditions: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$AndPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$AssignableFromPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$CompositionPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ContainsPatternPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$InPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$InstanceOfPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$IsEqualToPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$NotPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$1: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$2: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$3: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$4: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$OrPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Present: can't find referenced class javax.annotation.Nullable
build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.guava:guava:18.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2-beta+'
compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
compile project(':library')
compile project(':StyleableDateTimePicker-master')
compile 'com.facebook.android:facebook-android-sdk:3.23.+'
compile 'com.android.support:support-v4:22.0.0+'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.1.0#aar'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile 'com.github.alamkanak:android-week-view:1.2.1'
compile('ch.acra:acra:4.5.0') {
exclude group: 'org.json'
}
compile 'com.github.machinarius:preferencefragment:0.1.1'
}
I think I finally figured this one out!
gradle dependency:
dependencies {
...
compile 'com.google.guava:guava:18.0'
/* Required for using guava with proguard */
compile 'javax.annotation:jsr250-api:1.0'
}
Additions to my proguard configuration:
##-------------Begin Settings For Guava ------------------------------------------------------------
#https://github.com/krschultz/android-proguard-snippets/blob/master/libraries/proguard-guava.pro
# Configuration for Guava
#
# disagrees with instructions provided by Guava project: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava
#
# works if you add the following line to the Gradle dependencies
#
# provided 'javax.annotation:jsr250-api:1.0'
-keep class com.google.common.io.Resources {
public static <methods>;
}
-keep class com.google.common.collect.Lists {
public static ** reverse(**);
}
-keep class com.google.common.base.Charsets {
public static <fields>;
}
-keep class com.google.common.base.Joiner {
public static Joiner on(String);
public ** join(...);
}
-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry
-dontwarn sun.misc.Unsafe
-dontwarn javax.annotation.**
##-------------End Settings For Guava --------------------------------------------------------------
Links Which Helped Me
https://github.com/krschultz/android-proguard-snippets/blob/master/libraries/proguard-guava.pro
https://github.com/krschultz/android-proguard-snippets/issues/53
You can't use proguard anymore, you need use
minifyEnabled false

Categories

Resources