注意:com.google.common.cache.Striped64动态访问声明的字段“base”

时间:2015-10-12 01:00:14

标签: java android android-studio proguard android-proguard

我在Android Studio项目中使用ProGuard。当我构建我的版本时,我得到以下注释:

Note: com.google.common.cache.Striped64 accesses a declared field 'base' dynamically
      Maybe this is program field 'com.google.common.cache.Striped64 { long base; }'
      Maybe this is program field 'org.jsoup.nodes.Entities { java.util.Map base; }'
      Maybe this is program field 'org.jsoup.nodes.Entities$EscapeMode { org.jsoup.nodes.Entities$EscapeMode base; }'

我尝试用以下方法解决它:

-keep class org.jsoup.** { *; }
-keeppackagenames org.jsoup.nodes
-keep class com.google.common.cache.Striped64 { *; }
-keep class com.google.common.base.** { *; }

但它没有帮助。

如何解决此问题?

1 个答案:

答案 0 :(得分:4)

要解决此问题,您必须为proguard配置提供以下内容:

        public static void DisplayResults(string empName, decimal empWeeklySales, decimal COMMISSION_RATE, decimal grossPay, 
                                      decimal INCOME_TAX_RATE, decimal incomeTaxPayable, decimal PRSI_RATE, decimal prsiPayable,
                                      decimal RETIREMENT_CONTRIBUTION_RATE, decimal retirementContribution, 
                                      decimal totalDeductions, decimal takeHomePay)
    {
        Console.WriteLine("\n*************** WEEKLY PAYROLL APP ***************\n");

        Console.WriteLine("Employee Name: \t\t\t\t{0}\n", empName);
        Console.WriteLine("This week's sales: \t\t\t{0:n}", empWeeklySales);
        Console.WriteLine("Commission Rate: \t{0:F2}%\n", COMMISSION_RATE);

        Console.WriteLine("Gross Pay: \t\t\t\t{0:F2}", grossPay);
        Console.WriteLine("Income Tax: \t\t({0:F2}%) \t{1:F2}", INCOME_TAX_RATE, incomeTaxPayable);
        Console.WriteLine("PRSI: \t\t\t({0:F2}%) \t{1:F2}", PRSI_RATE, prsiPayable);
        Console.WriteLine("Retirement Contribution: ({0:F2}%) \t{1:F2}", RETIREMENT_CONTRIBUTION_RATE, retirementContribution);

        Console.WriteLine("Total Deductions: \t\t\t{0:F2}\n", totalDeductions);

        Console.WriteLine("Take Home Pay: \t\t\t\t{0:F2}\n", takeHomePay);

        Console.WriteLine("\n**************************************************");
    }

这只是意味着不要重命名任何类中任何类型的名为“base”的所有成员。

像魅力一样。