Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

error while adding multiple proguard directory in release type #138

Open
TheReprator opened this issue Oct 10, 2016 · 11 comments
Open

error while adding multiple proguard directory in release type #138

TheReprator opened this issue Oct 10, 2016 · 11 comments

Comments

@TheReprator
Copy link

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
screen shot 2016-10-10 at 7 00 56 pm

@jdulaney
Copy link

switch it to

proguardFiles fileTree(dir: "cproguardfiles", include: ["*.pro"]).asList().toArray()

@TheReprator
Copy link
Author

thanks it worked.

@TheReprator
Copy link
Author

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.

screen shot 2016-10-13 at 10 52 44 am

@sauravexodus
Copy link

Include these in your proguard-rules.pro

-dontwarn com.fasterxml.**
-dontwarn okio.**
-dontwarn retrofit2.**

@TheReprator
Copy link
Author

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.

@sauravexodus
Copy link

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

@enginebai
Copy link

I had the same problem as well.

android {
    ....
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            FileCollection proguardFileCollection = files { file('./proguard').listFiles() }
            proguardFiles(proguardFileCollection)
        }
    }
}

It seem
2016-11-23 12 32 17

@TheReprator
Copy link
Author

please add this "proguardFiles fileTree(dir: "proguard", include: ["*.pro"]).asList().toArray()"

and remove these lines,
FileCollection proguardFileCollection = files { file('./proguard').listFiles() }
proguardFiles(proguardFileCollection)

@TheReprator
Copy link
Author

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

@trevorwang
Copy link

@chriscoderdr
Copy link

@TheGreat0004 line of code solved it for me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants