Menu

#595 Can't find referenced method void setLatestEventInfo

v5.2
closed-works-for-me
1
2016-03-28
2016-03-27
No

I got the following error when building my Android app with Proguard v5.2.1:

[2016-03-27 16:39:58 - MyApp] Proguard returned with error code 1. See console
[2016-03-27 16:39:58 - MyApp] Warning: android.support.v4.app.NotificationCompatBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
[2016-03-27 16:39:58 - MyApp] Warning: android.support.v4.app.NotificationCompatGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
[2016-03-27 16:39:58 - MyApp] Warning: there were 2 unresolved references to library class members.
[2016-03-27 16:39:58 - MyApp]          You probably need to update the library versions.
[2016-03-27 16:39:58 - MyApp]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
[2016-03-27 16:39:58 - MyApp] java.io.IOException: Please correct the above warnings first.
[2016-03-27 16:39:58 - MyApp]   at proguard.Initializer.execute(Initializer.java:473)
[2016-03-27 16:39:58 - MyApp]   at proguard.ProGuard.initialize(ProGuard.java:233)
[2016-03-27 16:39:58 - MyApp]   at proguard.ProGuard.execute(ProGuard.java:98)
[2016-03-27 16:39:58 - MyApp]   at proguard.ProGuard.main(ProGuard.java:538)
[2016-03-27 16:46:05 - MyApp] Proguard returned with error code 1. See console
[2016-03-27 16:46:05 - MyApp] Warning: android.support.v4.app.NotificationCompatBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
[2016-03-27 16:46:05 - MyApp] Warning: android.support.v4.app.NotificationCompatGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
[2016-03-27 16:46:05 - MyApp] Warning: there were 2 unresolved references to library class members.
[2016-03-27 16:46:05 - MyApp]          You probably need to update the library versions.
[2016-03-27 16:46:05 - MyApp]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
[2016-03-27 16:46:05 - MyApp] java.io.IOException: Please correct the above warnings first.
[2016-03-27 16:46:05 - MyApp]   at proguard.Initializer.execute(Initializer.java:473)
[2016-03-27 16:46:05 - MyApp]   at proguard.ProGuard.initialize(ProGuard.java:233)
[2016-03-27 16:46:05 - MyApp]   at proguard.ProGuard.execute(ProGuard.java:98)
[2016-03-27 16:46:05 - MyApp]   at proguard.ProGuard.main(ProGuard.java:538)

I don't use the "setLatestEventInfo" method in my app nor I can see it's been used in the support libraries in my Android project: AppCompat v7, ACRA v4.8.5, Android LVL. So, I don't know what classes Proguard found the "setLatestEventInfo" method as the error message does not provide any indication,

I'm using:

Android SDK Platform Tools v23.1
Android SDK Build Tools v23.0.3
Android Support Library v23.2.1

Is this a bug with Proguard v5.2.1?

Please comment.

Thank you.

Discussion

  • Chuong Le Pham

    Chuong Le Pham - 2016-03-27

    I have added these directives to my "proguard-project.txt" file, but I still got the error:

    -dontwarn android.support.v4.**
    -keep public class com.google.android.gms.* { public *; }
    -dontwarn com.google.android.gms.**
    
     

    Last edit: Chuong Le Pham 2016-03-27
  • Eric Lafortune

    Eric Lafortune - 2016-03-28

    As the error message indicates, android.support.v4.app.NotificationCompatBase refers to android.app.Notification # setLatestEventInfo. You can build against a later version of the Android runtime (one that does contain this method), or you can indeed suppress the warning:

    -dontwarn android.support.v4.**
    

    or

    -dontwarn android.app.Notification
    

    If this doesn't seem to work, you should double-check that the configuration file is read (e.g. by adding a bogus option).

     
  • Eric Lafortune

    Eric Lafortune - 2016-03-28
    • status: open --> closed-works-for-me
    • assigned_to: Eric Lafortune
     
  • Chuong Le Pham

    Chuong Le Pham - 2016-03-28

    This comment from you got me thinking on the right track:

    If this doesn't seem to work, you should double-check that the configuration file is read (e.g. by adding a bogus option).

    Things I tried that did not work were:

    • Add -dontwarn android.support.v4.**.
    • Add -dontwarn android.app.Notification
    • Add a bogus directive -dontreport android.app.Notification

    None of the things I tried above would work. Even the last bogus directive was happily processed by Proguard.

    Then, I check my project.properties file for the affected projects and I was surprised to see two proguard.config directives in each of those projects:

    • proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt (This one should be used to build the Android project with).
    • proguard.config=proguard.config (Bogus entry added to my Android projects which I don't know how it got there!)

    The only thing that could have added those bogus proguard.config=proguard.config entries in my Android projects would be Andmore- since I recently upgraded from ADT (which is now defunct and unsupported) to Andmore. So, I added another instance of Eclipse on a separate disk drive, then add Andmore, compile and run a test build with Proguard. However, I could not see Andmore adding a bogus proguard.config=proguard.config entry into this test project. Next, I check my recorded Windows macro / screen capture video to see if I have inadvertently added any unnecessary step(s) when I upgraded to Andmore. Can't find anything wrong there either!

    Anyway, long story short, I have deleted the second bogus proguard.config=proguard.config directive from my Android projects and they are building fine now with Proguard. I will now investigate a way with Ant to check for multiple similar config directives in my Android projects to eliminate any issue with bogus directives in Proguard's properties files.

    Please accept my sincerest apology for have wasted your valuable time. Your last comment did help me to back-trace and resolve build issue I had with Proguard.

    Kind regards
    C.

     

    Last edit: Chuong Le Pham 2016-03-28

Log in to post a comment.

MongoDB Logo MongoDB