Issue building apk file - android

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

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'
}

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

Applying proguard only for instrumentation apk

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

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

Categories

Resources