Proguard的告诉我,'请首先纠正了上述警告。“。如何解决外部罐子的参考? [英] Proguard tells me 'Please correct the above warnings first.'. How to address references of external jars?

查看:1042
本文介绍了Proguard的告诉我,'请首先纠正了上述警告。“。如何解决外部罐子的参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能解决的警告?

日志说:

  [ProGuard的]注意:复制库类的定义?
 ...
 [ProGuard的]注:有370重复的类定义。
 [ProGuard的]初始化...
 [ProGuard的]警告:abc.cba ..:无法找到父类或接口xyz.zyx ....
 ...
 [ProGuard的]注:配置指的是未知类的android.app.backup.BackupAgentHelper...
 ...
 [ProGuard的]警告:库班android.content.IntentFilter取决于程序类org.xmlpull.v1.XmlSerializer ...
 ...
 

proguard.cfg

  -optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dont preverify
-verbose
-optimizations!code /简/算术,!现场/ * ,!类/合并/ *

-keep公共类*扩展android.app.Activity
-keep公共类*扩展android.app.Application
-keep公共类*扩展android.app.Service
-keep公共类*扩展android.content.BroadcastReceiver
-keep公共类*扩展android.content.ContentProvider
-keep公共类*扩展android.app.backup.BackupAgentHelper
-keep公共类*扩展的Andr​​oid。preference。preference
-keep公共类com.android.vending.licensing.ILicensingService
-keep公共类testAppH23 ** {*!。 }

-keepclasseswithmembernames类* {
    天然的LT;方法&gt ;;
}

-keepclasseswithmembers类* {
    公共和LT; INIT>(android.content.Context,android.util.AttributeSet);
}

-keepclasseswithmembers类* {
    公共和LT; INIT>(android.content.Context,android.util.AttributeSet,INT);
}

-keepclassmembers类*扩展android.app.Activity {
   公共无效*(android.view.View);
}

-keepclassmembers枚举* {
    公共静态** []值();
    公共静态**的valueOf(java.lang.String中);
}

-keep类*实现android.os.Parcelable {
  公共静态最终android.os.Parcelable $造物主*;
}
 

下面是 Android的Ant构建使用ProGuard启用控制台日志。请参阅链接 Ant构建控制台日志

这是我的build.xml(基本上它是Android原ant脚本)。请参阅链接 TestAppH23 Android的Ant构建使用ProGuard启用

local.properties

  sdk.dir = C:\\ androiddev \\ Android的SDK-窗口
 

build.properties

  proguard.config = proguard.cfg
key.store = testapph23,release.keystore
key.alias = alisname
key.store.password = storepassword
key.alias.password = aliaspassword
 

default.properties

 目标=机器人-7
 

我的道歉长期职位。在正确的方向任何指导的AP preciated。

UPDATES1 * 的Andr​​oidManifest.xml 的*

 < XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
      包=testAppH23.activity
      安卓版code =1
      机器人:VERSIONNAME =1.0>
    <应用
        机器人:图标=@可绘制/家
        机器人:主题=@安卓风格/ Theme.NoTitleBar
        机器人:标签=@字符串/ APP_NAME
        >
        <活动
            机器人:名称=。start.StartActivity
            机器人:标签=@字符串/ APP_NAME
            机器人:主题=@风格/ Theme.Translucent
            机器人:screenOrientation =画像
            机器人:launchMode =singleTask
            >
            <意向滤光器>
                <作用
                    机器人:名称=android.intent.action.MAIN
                    >
                < /作用>
                <类别
                    机器人:名称=android.intent.category.LAUNCHER
                    >
                < /类>
            &所述; /意图滤光器>
        < /活性GT;
        .....
        <服务机器人:名称=com.abc.myjar.papi.PIntentService>< /服务>

        <服务机器人:名称=。service.XyzService>< /服务>

    < /用途>


    <使用库机器人:名称=org.apache.http.entity/>
    <使用库机器人:名称=org.apache.http.james.mime4j/>

    <使用-权限的Andr​​oid:名称=android.permission ....../>

    <使用-SDK安卓的minSdkVersion =7/>

< /舱单>
 

解决方案

您必须安抚ProGuard的,在输入罐子一些可疑的结构都ok。

您计划code中的副本或更高版本的包org.xmlpull.v1 Android的运行时类的。如果这是确定:

  -dontwarn org.xmlpull.v1。**
-dontnote org.xmlpull.v1。**
 

您计划code包含org.apache.http Android的运行时类的副本。如果这是确定:

  -dontnote org.apache.http。**
 

您计划code在包中的例子指的是AWT,这并不在Android的存在。如果这是确定:

  -dontwarn java.awt中。**
 

您的PostgreSQL驱动程序是指没有在Android中存在着很多的javax类。如果这是确定:

  -dontwarn org.postgresql。**
 

等等...

(CFR)。 ProGuard的手动> 故障排除

最后,你的配置指定-keep公共类testAppH23 **!{*;},这使所有的公共课,除了那些在testAppH23,和他们的公共/保护/私营类成员,被缩小/优化/模糊处理。这可能会导致有关描述符类的一些(无害)笔记。为了保持一致性,你可能需要删除公的课程,或为类成员添加公共保护。

How can I address the warnings?

Log says

 [proguard] Note: duplicate definition of library class...
 ...
 [proguard] Note: there were 370 duplicate class definitions.
 [proguard] Initializing...
 [proguard] Warning: abc.cba..: can't find superclass or interface xyz.zyx....
 ...
 [proguard] Note: the configuration refers to the unknown class 'android.app.backup.BackupAgentHelper'...
 ...
 [proguard] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer...
 ...

proguard.cfg

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep public class !testAppH23.** { *; }

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

Here is the Android Ant Build with Proguard Enabled console log. Please see the link ant build console log

Here is my build.xml (basically its the android original ant script). Please see the link TestAppH23 Android Ant Build With Proguard Enabled

local.properties

sdk.dir=C:\\androiddev\\android-sdk-windows

build.properties

proguard.config=proguard.cfg
key.store=testapph23-release.keystore
key.alias=alisname
key.store.password=storepassword
key.alias.password=aliaspassword

default.properties

target=android-7

My apology for long post. Any guidance on the right direction is appreciated.

UPDATES1 *AndroidManifest.xml*

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="testAppH23.activity"
      android:versionCode="1"
      android:versionName="1.0">
    <application
        android:icon="@drawable/home"
        android:theme="@android:style/Theme.NoTitleBar"
        android:label="@string/app_name"
        >
        <activity
            android:name=".start.StartActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Translucent"
            android:screenOrientation="portrait"
            android:launchMode="singleTask"
            >
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN"
                    >
                </action>
                <category
                    android:name="android.intent.category.LAUNCHER"
                    >
                </category>
            </intent-filter>
        </activity>
        .....
        <service android:name="com.abc.myjar.papi.PIntentService"></service>

        <service android:name=".service.XyzService"></service>

    </application>


    <uses-library android:name="org.apache.http.entity"/>
    <uses-library android:name="org.apache.http.james.mime4j"/>

    <uses-permission android:name="android.permission...."/>

    <uses-sdk android:minSdkVersion="7" />

</manifest>

解决方案

You have to reassure ProGuard that some suspicious constructs in the input jars are ok.

Your program code contains copies or better versions of Android runtime classes in the package org.xmlpull.v1. If that's ok:

-dontwarn org.xmlpull.v1.**
-dontnote org.xmlpull.v1.**

Your program code contains copies of Android runtime classes in org.apache.http. If that's ok:

-dontnote org.apache.http.**

Your program code in the package examples refers to AWT, which doesn't exist in Android. If that's ok:

-dontwarn java.awt.**

Your PostgreSQL driver refers to many javax classes that don't exist in Android. If that's ok:

-dontwarn org.postgresql.**

And so on...

Cfr. ProGuard manual > Troubleshooting

Finally, your configuration specifies "-keep public class !testAppH23.** { *;}", which keeps all public classes except those in testAppH23, and their public/protected/private class members, from being shrunk/optimized/obfuscated. This may cause some (harmless) notes about descriptor classes. For consistency, you may want to remove "public" for the classes, or add "public protected" for the class members.

这篇关于Proguard的告诉我,'请首先纠正了上述警告。“。如何解决外部罐子的参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆