android-proguard-snippets
android-proguard-snippets copied to clipboard
error while adding multiple proguard directory in release type
FileCollection proGuardFileCollection = files { file('./cproguardfiles').listFiles() } proguardFiles(proGuardFileCollection)
Folder name is: cproguardfiles(in project structure )
Error:(23, 0) Cannot convert the provided notation to a File or URI: file collection. The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A URI or URL instance.
This is
switch it to
proguardFiles fileTree(dir: "cproguardfiles", include: ["*.pro"]).asList().toArray()
thanks it worked.
although the error is removed but it didn't accept the proguard files added, here is the screenshot of the error
here is the error along with screenshot, Warning:com.fasterxml.jackson.databind.ext.PathDeserializer: can't find referenced class java.nio.file.Path Warning:com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning:com.fasterxml.jackson.databind.ext.PathDeserializer: can't find referenced class java.nio.file.Paths Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.Transient Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.Transient Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.ConstructorProperties Warning:com.fasterxml.jackson.databind.ext.PathDeserializer: can't find referenced class java.nio.file.Path Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.ConstructorProperties Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.Transient Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.ConstructorProperties Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.Transient Warning:com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector$Java7Support: can't find referenced class java.beans.ConstructorProperties 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 method 'boolean isDefault()' in library class java.lang.reflect.Method 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:there were 41 unresolved references to classes or interfaces. Warning:there were 1 unresolved references to library class members. Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForClientDebug'.
java.io.IOException: Please correct the above warnings first.
Include these in your proguard-rules.pro
-dontwarn com.fasterxml.** -dontwarn okio.** -dontwarn retrofit2.**
if i add these lines in proguard-rules.pro, then "{ file('./cproguardfiles').listFiles() }" will be useless, your as well as mine efforts will go in vein.
I don't understand. Can you provide any reference?
What I read about -dontwarn is they are only used to ignore warnings while building. So if you know that some unreferenced class won't create a mess in your project then its totally okay to use these.
http://proguard.sourceforge.net/manual/usage.html
I had the same problem as well.
android {
....
buildTypes {
release {
minifyEnabled true
shrinkResources true
FileCollection proguardFileCollection = files { file('./proguard').listFiles() }
proguardFiles(proguardFileCollection)
}
}
}
It seem
please add this "proguardFiles fileTree(dir: "proguard", include: ["*.pro"]).asList().toArray()"
and remove these lines, FileCollection proguardFileCollection = files { file('./proguard').listFiles() } proguardFiles(proguardFileCollection)
@sauravexodus , means i include these then, what will be the advantage of adding your file as i have to write the code in my own proguard files.
https://code.google.com/p/android/issues/detail?id=212882
@TheGreat0004 line of code solved it for me