签名应用程序期间库中的警告

Warnings in libraries during signing app

 buildscript {
        repositories {
            maven { url 'https://maven.fabric.io/public' }
        }

        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }
    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'

    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }


    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "com.example.hello"
            minSdkVersion 9
            targetSdkVersion 21
            compileOptions {
                sourceCompatibility JavaVersion.VERSION_1_7
                targetCompatibility JavaVersion.VERSION_1_7
            }
        }

        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile 'com.android.support:support-v4:22.2.0'
        compile 'com.google.code.gson:gson:2.2.4'
        compile 'com.android.support:appcompat-v7:22.2.0'
        compile 'com.google.android.gms:play-services:+'
        compile files('libs/bolts-android-1.2.0.jar')
        compile files('libs/facebook.jar')
        compile 'de.hdodenhof:circleimageview:1.2.1'
        compile 'com.android.support:recyclerview-v7:21.0.+'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.jakewharton:butterknife:6.1.0'
        compile 'com.android.support:cardview-v7:21.0.+'
        compile 'com.github.bumptech.glide:glide:3.5.2'
        compile 'com.android.support:support-v4:22.0.0'
        compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
            transitive = true;
        }
        compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
        compile project(':gcmv')
        compile 'com.android.support:design:22.2.0'
    }

今天,当我使用混淆器签署我的应用程序时,它在我的库中显示了太多警告。 所以由于警告我无法生成我签名的 apk 文件。 那么有什么方法可以在我的 gradle 文件中使用 "dontwarn"。

根据 ProGuard documentation:

The standard Android build process automatically specifies the input jars for you. Unfortunately, many pre-compiled third-party libraries refer to other libraries that are not actually used and therefore not present. This works fine in debug builds, but in release builds, ProGuard expects all libraries, so it can perform a proper static analysis. For example, if ProGuard complains that it can't find a java.awt class, then some library that you are using is referring to java.awt. This is a bit shady, since Android doesn't have this package at all, but if your application works anyway, you can let ProGuard accept it with "-dontwarn java.awt.**", for instance.

如上所述,如果它在调试中运行良好,您可以使用 -dontwarn 作为 class 过滤器:

Specifies not to warn about unresolved references and other important problems at all. The optional filter is a regular expression; ProGuard doesn't print warnings about classes with matching names. Ignoring warnings can be dangerous. For instance, if the unresolved classes or class members are indeed required for processing, the processed code will not function properly.

看来您使用的是毕加索库。

尝试在混淆文件中添加这一行。 (proguard-rules.pro 在您的应用模块中)

-dontwarn com.squareup.okhttp.**