生成签名APK中的java.io.IOException

时间:2016-08-04 07:14:55

标签: android-studio release android-proguard

我正在尝试在我的应用程序中使用'Proguard'。应用程序将在AVD中构建完美并运行,但当我尝试在android studio中发布我的应用程序时,我收到IOException异常,如下所示:

    Note: the configuration keeps the entry point 'android.support.design.widget.NavigationView { void setNavigationItemSelectedListener(android.support.design.widget.NavigationView$OnNavigationItemSelectedListener); }', but not the descriptor class 'android.support.design.widget.NavigationView$OnNavigationItemSelectedListener'
    Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnLayoutChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener'
    Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnAttachStateChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener'
    Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setOnTabSelectedListener(android.support.design.widget.TabLayout$OnTabSelectedListener); }', but not the descriptor class 'android.support.design.widget.TabLayout$OnTabSelectedListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAdSizes(com.google.android.gms.ads.AdSize[]); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAppEventListener(com.google.android.gms.ads.doubleclick.AppEventListener); }', but not the descriptor class 'com.google.android.gms.ads.doubleclick.AppEventListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setCorrelator(com.google.android.gms.ads.Correlator); }', but not the descriptor class 'com.google.android.gms.ads.Correlator'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setOnCustomRenderedAdLoadedListener(com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener); }', but not the descriptor class 'com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.formats.NativeAdView { void setNativeAd(com.google.android.gms.ads.formats.NativeAd); }', but not the descriptor class 'com.google.android.gms.ads.formats.NativeAd'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
    Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
    Note: the configuration keeps the entry point 'com.google.android.gms.flags.impl.FlagProviderImpl { void init(com.google.android.gms.dynamic.zzd); }', but not the descriptor class 'com.google.android.gms.dynamic.zzd'
    Note: the configuration keeps the entry point 'com.google.android.gms.plus.PlusOneButton { void setOnPlusOneClickListener(com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener); }', but not the descriptor class 'com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener'
    Note: there were 3 references to unknown classes.
    You should check your configuration for typos.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
    Note: there were 23 unkept descriptor classes in kept class members.
    You should consider explicitly keeping the mentioned classes
    (using '-keep').
    (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
    Note: there were 12 unresolved dynamic references to classes or interfaces.
    You should check if you need to specify additional program jars.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
    Warning:there were 127 unresolved references to classes or interfaces.
    You may need to add missing library jars or update their versions.
    If your code works fine without the missing classes, you can suppress
    the warnings with '-dontwarn' options.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
    Warning:there were 48 instances of library classes depending on program classes.
    You must avoid such dependencies, since the program classes will
    be processed, while the library classes will remain unchanged.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
    Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
    :app:transformClassesAndResourcesWithProguardForRelease FAILED
    Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
    > java.io.IOException: Please correct the above warnings first.

这就是格斗:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "24.0.0"

        packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
        }
    defaultConfig {
    applicationId "ir.onlinegpstracker.iranavl.onlinegpstracker"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0.0"
    multiDexEnabled true
        }

    buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    dexOptions {
    javaMaxHeapSize "4g"
        }
    }

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/jtds-1.3.0.jar')
    compile files('libs/httpclient-4.1.jar')
    compile files('libs/http-core-4.1.jar')


    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    }

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

实际上,代码没有错误。因此需要在proguard-rules.pro中添加这些代码来忽略。

-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-dontnote com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-dontwarn org.apache.commons.**
-dontwarn org.apache.http.**
-keep class org.apache.http.** { *; }
-dontwarn jcifs.http.NetworkExplorer
-keep class android.support.v4.** { *; }
-dontnote android.support.v4.**
-keep class android.support.v7.** { *; }
-dontnote android.support.v7.**

现在它可以毫无问题地工作。 感谢。