【问题标题】:ProGuard error trying to generate signed apkProGuard 错误尝试生成签名的 apk
【发布时间】:2016-07-06 05:46:05
【问题描述】:

这是我的日志。当我尝试生成签名的 apk 时会出现问题:

Initializing...
Note: the configuration refers to the unknown class 'com.sourcey.example.SignupActivity'
Note: com.google.android.gms.internal.zzro calls 'Field.getType'
Note: butterknife.internal.ViewInjector calls 'Class.getEnclosingClass'
Warning:com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.google.android.gms.gcm.zza: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Note: com.google.android.gms.maps.internal.zzy: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImplGmm6
Note: com.google.android.gms.maps.internal.zzy: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImpl
Note: org.apache.james.mime4j.storage.DefaultStorageProvider calls '(org.apache.james.mime4j.storage.StorageProvider)Class.forName(variable).newInstance()'
Note: there were 1 references to unknown classes.
  You should check your configuration for typos.
  (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 1 classes trying to access generic signatures using reflection.
  You should consider keeping the signature attributes
  (using '-keepattributes Signature').
  (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 1 classes trying to access enclosing classes using reflection.
  You should consider keeping the inner classes attributes
  (using '-keepattributes InnerClasses').
  (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 2 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)
Note: there were 1 class casts of dynamically created class instances.
  You might consider explicitly keeping the mentioned classes and/or
  their implementations (using '-keep').
  (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclasscast)
Warning:there were 2 unresolved references to library class members.
     You probably need to update the library versions.
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
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.
Information:BUILD FAILED
Information:Total time: 22.714 secs
Information:1 error
Information:4 warnings
Information:See complete output in console

我的模块 build.grade:

 defaultConfig {
    applicationId "com.sourcey.example"
    minSdkVersion 15
    //targetSdkVersion 22
    targetSdkVersion 23
    versionCode 28
    versionName "3.0.2.1"
    signingConfig signingConfigs.config
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

问题可能是警告,但我不知道

我的项目 build.gradle:

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

最后,我的 proguard-rules.pro:

-dontwarn butterknife.internal.**

-keep class **$$ViewInjector { *; }

-keepnames class * { @butterknife.InjectView *;}

-dontwarn butterknife.Views$InjectViewProcessor

-dontwarn com.gc.materialdesign.views.**

-dontwarn com.kosalgeek.**

-dontwarn org.apache.**

-dontwarn android.support.v4.**

谢谢你帮助我! 非常感谢

【问题讨论】:

    标签: android proguard android-proguard


    【解决方案1】:

    您有 2 条来自 Google GMS 服务的警告。要忽略它们,请使用以下配置:

    -dontwarn com.google.android.gms.**
    

    还有一些注意事项您还应该考虑:

    -keepattributes Signature,InnerClasses
    

    其余的注释或多或少是无害的,但您可能希望通过适当的-dontnote 配置忽略它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 2018-06-12
      • 1970-01-01
      • 2018-09-11
      • 2017-02-15
      • 2016-08-08
      相关资源
      最近更新 更多