Wednesday, August 24, 2016

android how to resolve compile release APK, Proguard error: "Warning:"


  今天在打正式包的时候,突然报错了。 让我有点懵逼了。然后, 打正式包的时候报错了。

解决方案:
就是在代码混淆的时候,去掉这些 waring:


例如 :
# android 6.0 SDK 23 start-dontwarn com.nhaarman.listviewanimations.** { *; }
-dontwarn com.solok.datetime.** { *; }
-dontwarn com.tencent.connect.avatar.** { *; }
-dontwarn com.viewpagerindicator.LinePageIndicator.** { *; }
-dontwarn uk.co.senab.photoview.** { *; }



# android 6.0 SDK 23 end


OK 你看一下你的报错的信息里面,需要注释的 warning 一一添加就可以了!

这里解析一下:
因为,我把编译的版本提高了23,所以,就会出现一些工具方法过时的问题。因为, Android 6.0 废弃了很多没有用的方法。所以,导致了我们在适配6.0 的时候,很多依赖的第三方可能还没有适配6.0 ,所以出现了这么多的warning!

其实,很多的第三方的一些类,我们根本没有用到。这里直接在混淆文件里面直接 使用 dontwarn  就可以了,但是,如果自己的写的依赖库, 可能用到了 过时的方法。这个时候,我们就要手动的去修改依赖库的代码了!


这样说吧:
--dontwarn  只是不报错,只是治标不治本
修改原生代码,  根治这个问题


error info:

Initializing...
Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.facebook.react.uimanager.UIProp'
Note: the configuration refers to the unknown class 'sun.misc.Unsafe'
Note: the configuration refers to the unknown class 'com.eallcn.rentagent.orm.SugarRecord'
      Maybe you meant the fully qualified name 'com.orm.SugarRecord'?
Note: the configuration refers to the unknown class 'com.eallcn.chow.entity.RepTrend'
      Maybe you meant the fully qualified name 'com.eallcn.rentagent.entity.common.RepTrend'?
Note: the configuration refers to the unknown class 'com.nhaarman.listviewanimations.itemmanipulation.dragdrop.DynamicListViewTestActivity'
Note: the configuration refers to the unknown class 'com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.SwipeTouchListenerTestActivity'
Note: the configuration refers to the unknown class 'se.emilsjolander.stickylistheaders.StickyListHeadersListView'
      Maybe you meant the fully qualified name 'com.eallcn.rentagent.widget.sticky.StickyListHeadersListView'?
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find superclass or interface se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.solok.datetime.WheelImageView: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: com.solok.datetime.WheelView: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: com.tencent.connect.avatar.c: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: uk.co.senab.photoview.PhotoViewAttacher: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: uk.co.senab.photoview.gestures.CupcakeGestureDetector: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks$Stub
Note: android.support.v4.media.ParceledListSliceAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v7.widget.DrawableUtils: can't find dynamically referenced class android.graphics.Insets
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Point
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Font
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Rectangle
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Color
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Color
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Font
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Point
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Rectangle
Note: com.baidu.location.b.d$a: can't find dynamically referenced class android.os.SystemProperties
Note: com.baidu.location.b.e: can't find dynamically referenced class android.os.storage.StorageVolume
Note: com.baidu.platform.comapi.util.e: can't find dynamically referenced class android.os.storage.StorageVolume
Note: com.facebook.common.webp.WebpSupportStatus: can't find dynamically referenced class com.facebook.webpsupport.WebpBitmapFactoryImpl
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImplSupport
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl
Note: com.facebook.imagepipeline.nativecode.WebpTranscoderFactory: can't find dynamically referenced class com.facebook.imagepipeline.nativecode.WebpTranscoderImpl
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.appengine.api.ThreadManager
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.apphosting.api.ApiProxy
Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
Note: com.hyphenate.chat.EMPushHelper: can't find dynamically referenced class com.google.android.gms.common.GooglePlayServicesUtil
Note: com.hyphenate.chat.EMPushHelper: can't find dynamically referenced class com.xiaomi.mipush.sdk.MiPushClient
Note: com.parse.ParseHttpClient: can't find dynamically referenced class com.squareup.okhttp.OkHttpClient
Note: com.sina.weibo.sdk.utils.AidTask: can't find dynamically referenced class android.os.SystemProperties
Note: com.tencent.mm.sdk.platformtools.NetStatusUtil: can't find dynamically referenced class android.app.ActivityManagerNative
Note: com.tencent.mm.sdk.platformtools.NetStatusUtil: can't find dynamically referenced class android.net.NetworkPolicyManager
Note: de.devland.esperandro.Esperandro: can't find dynamically referenced class de.devland.esperandro.serialization.GsonSerializer
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: org.jivesoftware.smack.XMPPConnection: can't find dynamically referenced class sun.security.pkcs11.SunPKCS11
Note: org.jivesoftware.smack.compression.JzlibInputOutputStream: can't find dynamically referenced class com.jcraft.jzlib.ZOutputStream
Note: org.jivesoftware.smack.compression.JzlibInputOutputStream: can't find dynamically referenced class com.jcraft.jzlib.ZInputStream
Note: there were 9 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 38 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 21 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 6 unresolved references to library class members.
         You probably need to update the library versions.
         Alternatively, you may have to specify the option
         '-dontskipnonpubliclibraryclassmembers'.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForMlwRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForMlwRelease'.
> java.io.IOException: Please correct the above warnings first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED


No comments:

Post a Comment