在更新Gradle Android build的依赖项以使用本地Maven附加存储库中的com.android.support:support-v4:22.2.0 (在软件开发工具包中)后,Proguard开始抛出这些问题。
Warning: android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle
Warning: android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ResolvedLayoutDirectionMode
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayoutDirectionMode
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayerType
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$AccessibilityLiveRegion
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ImportantForAccessibility
Warning: android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$OverScroll
Warning: android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$EdgeGravity
Warning: android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$LockMode
Warning: android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$State
Warning: there were 11 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)简单地添加-dontwarn android.support.v4.**就可以解决这个问题,但是我想要一个比忽略support.v4包中的所有问题更具体、更优雅的解决方案
谁能说出应该添加什么规则,这样Proguard才能正确处理这些类/@接口?
发布于 2015-07-22 21:11:49
唯一的解决方案就是你提到的,也就是-dontwarn android.support.v4.**。这实际上取自<path-to-android-sdk>/tools/proguard/proguard-android.txt,它说:
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**发布于 2015-06-09 13:10:36
根据Android团队的说法,为支持库类设置不警告是安全的。您可以通过以下方式执行此操作:
## Support library
-dontwarn android.support.**https://stackoverflow.com/questions/30645051
复制相似问题