15

I'm trying to build an Android release with Ant and ProGuard. I uncommented the following line in project.properties, despite the comment in said file noting that you shouldn't modify it ;):

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

When obfuscating, I get the following notes:

[proguard] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
[proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'

I do understand why this is happening. These lines can be found in the default ProGuard config file (${sdk.dir}/tools/proguard/proguard-android.txt):

-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

I'm not using the Google Licensing Service, so the classes are indeed unknown. I found a solution to get rid of these notes by updating the proguard-project.txt:

-dontnote **ILicensingService

My question: Is this the correct way of handling this? It seems to me that these classes shouldn't be kept by default anyway, since that lib isn't mandatory for an android project. The only way I can think of to achieve this is by copying the default config file to my project, removing the -keep lines and ignoring the default config file in the SDK completely. Which doesn't seem as the proper way to go either. Or am I missing something?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Roger Rapid
  • 956
  • 1
  • 8
  • 28

1 Answers1

17

The setting "-dontnote com.google.vending.licensing.ILicensingService" is fine. In fact, it could have been part of the default configuration file.

  1. The -keep option may be necessary for projects that use the library.
  2. The -dontnote option may be nice to suppress the note about the -keep option, for projects that don't use the library. The note is just a gentle reminder that the configuration file could contain a typo, because the specified class doesn't seem to exist. It doesn't affect the processing.
Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • Ah, makes sense in a way. I'll go with the -dontnote option then. Thanks for elaborating! Much appreciated. – Roger Rapid Jan 22 '13 at 16:49
  • For reference (SDK Tools 21): Do not run 'android update project -p .' *after* editing proguard-project.txt and *before* enabling proguard in project.properties. It will remove all changes. After proguard is enabled, changes will be kept. – Roger Rapid Jan 22 '13 at 20:29
  • hi, i am trying to build my project with build script and ProGuard. i am also facing the same problem. unable to understand what to do to fix this issue. so can you please help be with some example what i have to do. – Raj Apr 23 '13 at 10:50