ProGuard 在更新到 Android SDK 23 时失败
ProGuard fails when updating to Android SDK 23
我正在尝试将 Umweltzone Android application 更新到 SDK 23。因此,我将项目配置更改如下:
// Excerpt from Umweltzone/build.gradle
compileSdkVersion 23
// ...
compile "com.android.support:design:23.1.1"
当我构建 release 版本时,此 失败 并出现此错误(尾部):
...
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 2 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 100 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 5 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 3 accesses to class members by means of
introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Warning: there were 1 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.
:Umweltzone:transformClassesAndResourcesWithProguardForRelease FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':Umweltzone:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
发布版本适用于 SDK 22。可以找到 ProGuard 配置 here. The full build output can be found here 因为 Whosebug 不允许我在此处粘贴,因为长度限制。
坚持错误信息,即先更正上述警告。
上面的警告是:
com.google.android.gms.auth.GoogleAuthUtil: 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
您很可能不需要该方法。因此,您可以通过将以下行添加到 proguard 配置来消除警告:
-dontwarn com.google.android.gms.**
我正在尝试将 Umweltzone Android application 更新到 SDK 23。因此,我将项目配置更改如下:
// Excerpt from Umweltzone/build.gradle
compileSdkVersion 23
// ...
compile "com.android.support:design:23.1.1"
当我构建 release 版本时,此 失败 并出现此错误(尾部):
...
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 2 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 100 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 5 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 3 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members (using '-keep' or '-keepclassmembers').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)Warning: there were 1 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.
:Umweltzone:transformClassesAndResourcesWithProguardForRelease FAILEDFAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':Umweltzone:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
发布版本适用于 SDK 22。可以找到 ProGuard 配置 here. The full build output can be found here 因为 Whosebug 不允许我在此处粘贴,因为长度限制。
坚持错误信息,即先更正上述警告。
上面的警告是:
com.google.android.gms.auth.GoogleAuthUtil: 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
您很可能不需要该方法。因此,您可以通过将以下行添加到 proguard 配置来消除警告:
-dontwarn com.google.android.gms.**