minifyEnabled - true is not working in debug mode - android

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.**

Related

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

Android build error : Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'

I am new in using proguard and when I am building the api after creating signed api, I am getting these warnings and exceptions. I don't know how to solve it.
Here's the Error Log :
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Files
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
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 66 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
and my gradle looks like this:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
packagingOptions {
exclude 'LICENSE.txt'
}
lintOptions {
abortOnError false
}
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = 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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.android.support:support-annotations:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile "com.squareup.retrofit2:adapter-rxjava:2.1.0"
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
}
I don't know how to solve the error. I want to use proguard to reduce the size. Any help would be appreciated.
You need to add those lines to your proguard-rules.pro file:
# exclusions for Okio
-dontwarn okio.**
# exclusions for Retrofit
-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-keepattributes Signature
-keepattributes Exceptions
# exclusions for RxJava
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontwarn sun.misc.Unsafe
Dont' forget to load the correct file during the release build
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

Proguard file not being read

Problem: Doesn't seem like the proguard file is being read.
Error:
Information:Gradle tasks [:assembleDebug, :NativeXPlugin:assembleDebug,
:OneSignalConfig:assembleDebug, :answers:assembleDebug, :beta:assembleDebug, :cheetah-mobile:assembleDebug, :crashlytics:assembleDebug, :crashlytics-wrapper:assembleDebug, :fabric:assembleDebug, :fabric-init:assembleDebug]
Warning:com.adscendmedia.unity.SDKBridge$1: can't find superclass or interface com.adscendmedia.sdk.rest.video.RewardVideoListener
Warning:com.adscendmedia.unity.SDKBridge$2: can't find superclass or interface com.adscendmedia.sdk.util.CompletedOfferRequestListener
Warning:com.adscendmedia.unity.SDKBridge$3: can't find superclass or interface com.adscendmedia.sdk.util.ADOfferRequestListener
Warning:com.adscendmedia.unity.SDKBridge$4: can't find superclass or interface com.adscendmedia.sdk.util.JsonArrayRequestListener
Warning:com.adscendmedia.unity.SDKBridge$5: can't find superclass or interface com.adscendmedia.sdk.util.JsonArrayRequestListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find superclass or interface com.millennialmedia.InlineAd$InlineListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$2: can't find superclass or interface com.millennialmedia.InlineAd$InlineAbortListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find superclass or interface com.millennialmedia.InterstitialAd$InterstitialListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find superclass or interface com.mopub.mobileads.MoPubView$BannerAdListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find superclass or interface com.mopub.mobileads.MoPubInterstitial$InterstitialAdListener
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$1: can't find superclass or interface com.rhythmone.ad.sdk.RhythmEventListener
Warning:com.aerserv.sdk.adapter.astremor.ASTremorInterstitialProvider$1: can't find superclass or interface com.tremorvideo.sdk.android.videoad.TremorAdStateListener
Warning:com.aerserv.sdk.adapter.asunity.ASUnityInterstitialProvider: can't find superclass or interface com.unity3d.ads.android.IUnityAdsListener
Warning:com.appodeal.ads.a.u: can't find superclass or interface com.mopub.mobileads.MoPubView$BannerAdListener
Warning:com.appodeal.ads.b.x: can't find superclass or interface com.mopub.mobileads.MoPubInterstitial$InterstitialAdListener
Warning:com.appodeal.ads.c.p: can't find superclass or interface com.mopub.mobileads.MoPubView$BannerAdListener
Warning:com.appodeal.ads.e.p: can't find superclass or interface com.mopub.mobileads.MoPubInterstitial$InterstitialAdListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd$InlineListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd$InlineErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd$InlineErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd$InlineErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$1: can't find referenced class com.millennialmedia.InlineAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$2: can't find referenced class com.millennialmedia.InlineAd$InlineAbortListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialBannerProvider$2: can't find referenced class com.millennialmedia.InlineAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMSDK
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMException
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.AppInfo
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMSDK
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMException
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialAdMetadata
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMException
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.AppInfo
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMSDK
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMException
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.AppInfo
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialAdMetadata
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider: can't find referenced class com.millennialmedia.MMException
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialListener
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd$InterstitialErrorStatus
Warning:com.aerserv.sdk.adapter.asmillennial.ASMillennialInterstitialProvider$1: can't find referenced class com.millennialmedia.InterstitialAd
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1: can't find referenced class com.mopub.mobileads.MoPubView$BannerAdListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubView$BannerAdListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$1$1: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkBannerProvider$2: can't find referenced class com.mopub.mobileads.MoPubView
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider: can't find referenced class com.mopub.mobileads.MoPubInterstitial
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider: can't find referenced class com.mopub.mobileads.MoPubInterstitial$InterstitialAdListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider: can't find referenced class com.mopub.mobileads.MoPubInterstitial
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubInterstitial$InterstitialAdListener
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubInterstitial
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubInterstitial
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubErrorCode
Warning:com.aerserv.sdk.adapter.asmopubsdk.ASMoPubSdkInterstitialProvider$1: can't find referenced class com.mopub.mobileads.MoPubInterstitial
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider: can't find referenced class com.rhythmone.ad.sdk.RhythmEventListener
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$1: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$1: can't find referenced class com.rhythmone.ad.sdk.RhythmEventListener
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$1: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmEventListener
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$2: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$3: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$4: can't find referenced class com.rhythmone.ad.sdk.RhythmOneAd
Warning:com.aerserv.sdk.adapter.asrhythmonesdk.ASRhythmOneSdkInterstitialProvider$5: can't find referenced class com.rhythmone.ad.sdk.RhythmEvent
Warning:com.aerserv.sdk.adapter.astremor.ASTremorInterstitialProvider: can't find referenced class com.tremorvideo.sdk.android.videoad.TremorVideo
Warning:com.aerserv.sdk.adapter.astremor.ASTremorInterstitialProvider$1: can't find referenced class com.tremorvideo.sdk.android.videoad.TremorAdStateListener
Warning:com.aerserv.sdk.adapter.asunity.ASUnityInterstitialProvider: can't find referenced class com.unity3d.ads.android.UnityAds
Warning:there were 479 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 ':transformClassesAndResourcesWithProguardForDebug'.
> Job failed, see logs for details
Information:BUILD FAILED
Information:Total time: 10.838 secs
Information:1 error
Information:276 warnings
Information:See complete output in console
Build Gradle:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name: 'animated-vector-drawable-23.4.0', ext:'aar')
compile(name: 'appcompat-v7-23.4.0', ext:'aar')
compile(name: 'cardview-v7-23.4.0', ext:'aar')
compile(name: 'customtabs-23.4.0', ext:'aar')
compile(name: 'facebook-android-sdk-4.17.0', ext:'aar')
compile(name: 'facebook-android-wrapper-7.9.0', ext:'aar')
compile(name: 'onesignal-unity', ext:'aar')
compile(name: 'play-services-ads-10.2.0', ext:'aar')
compile(name: 'play-services-ads-lite-10.2.0', ext:'aar')
compile(name: 'play-services-base-10.2.0', ext:'aar')
compile(name: 'play-services-basement-10.2.0', ext:'aar')
compile(name: 'play-services-clearcut-10.2.0', ext:'aar')
compile(name: 'play-services-gass-10.2.0', ext:'aar')
compile(name: 'play-services-gcm-10.2.0', ext:'aar')
compile(name: 'play-services-iid-10.2.0', ext:'aar')
compile(name: 'play-services-location-10.2.0', ext:'aar')
compile(name: 'play-services-tasks-10.2.0', ext:'aar')
compile(name: 'pollfish-googleplay-4.3.1', ext:'aar')
compile(name: 'simple-android-notifications', ext:'aar')
compile(name: 'support-v4-24.0.0', ext:'aar')
compile(name: 'support-vector-drawable-23.4.0', ext:'aar')
compile project(':answers')
compile project(':beta')
compile project(':cheetah-mobile')
compile project(':crashlytics')
compile project(':crashlytics-wrapper')
compile project(':fabric')
compile project(':fabric-init')
compile project(':NativeXPlugin')
compile project(':OneSignalConfig')
compile 'com.android.support:multidex:1.0.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
targetSdkVersion 25
multiDexEnabled true
}
lintOptions {
abortOnError false
}
signingConfigs { release {
storeFile file('C:/Users/Josh/Desktop/KidKiwiKeyStore.keystore')
storePassword ''
keyAlias ''
keyPassword ''
} }
buildTypes {
debug {
jniDebuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
signingConfig signingConfigs.release
}
}
}
I have a proguard-unity.txt file in my root folder, but it doesn't seem to be read when I build an apk. Am I missing something?
Thanks
It's normal to get warning when proguard file is being read properly :) .. we solve these warning one by one by adding more lines to the proguard file. try for example adding :
-dontwarn com.aerserv.sdk.adapter.**
and see if some of the warning above will go away.

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