欢迎使用CSDN-markdown编辑器

前几天用Androidstudio进行打包时出现一个错误——-

Error:Execution failed for task ‘:app:transformClassesAndResourcesWithProguardForRelease’.
java.io.IOException: Please correct the above warnings first.

然后一直打包不成功。其实原因是这样的在我们引入第三方库时在build.gradle中有这样一句话

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

在proguard-rules.pro这个文件中代码混淆有问题,然后在AndroidStudio 的Messages中有很多的警告信息,那么多半是因为混淆的问题。以下是我集成第三方库后打包出现的信息:

Warning:com.umeng.fb.push.b 1:cantfindsuperclassorinterfacecom.umeng.message.UmengMessageHandlerWarning:com.umeng.fb.ConversationActivity:cantfindreferencedmethodvoidfinish()inprogramclasscom.umeng.fb.ConversationActivityWarning:com.umeng.fb.ConversationActivity:cantfindreferencedmethodandroid.app.ActionBargetActionBar()inprogramclasscom.umeng.fb.ConversationActivityWarning:com.umeng.fb.ConversationActivity:cantfindreferencedmethodandroid.content.IntentgetIntent()inprogramclasscom.umeng.fb.ConversationActivityWarning:com.umeng.fb.ConversationActivity:cantfindreferencedmethodandroid.support.v4.app.FragmentManagergetSupportFragmentManager()inprogramclasscom.umeng.fb.ConversationActivityWarning:com.umeng.fb.ConversationActivity:cantfindreferencedmethodvoidsetContentView(int)inprogramclasscom.umeng.fb.ConversationActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodandroid.view.ViewfindViewById(int)inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodvoidfinish()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodandroid.app.ActionBargetActionBar()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodandroid.content.res.ResourcesgetResources()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodandroid.support.v4.app.FragmentManagergetSupportFragmentManager()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodandroid.view.WindowgetWindow()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity:cantfindreferencedmethodvoidsetContentView(int)inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity a: can’t find referenced method ‘android.content.Context getApplicationContext()’ in program class com.umeng.fb.HelpActivity
Warning:com.umeng.fb.HelpActivity a:cantfindreferencedmethodandroid.content.IntentgetIntent()inprogramclasscom.umeng.fb.HelpActivityWarning:com.umeng.fb.HelpActivity a: can’t find referenced method ‘android.content.res.Resources getResources()’ in program class com.umeng.fb.HelpActivity
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘android.support.v4.app.FragmentActivity getActivity()’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘android.os.Bundle getArguments()’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘android.content.res.Resources getResources()’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘void setArguments(android.os.Bundle)’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘void setColorSchemeResources(int[])’ in program class com.umeng.fb.widget.InterceptTouchSwipeRefreshLayout
Warning:com.umeng.fb.fragment.FeedbackFragment: can’t find referenced method ‘void setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout OnRefreshListener)inprogramclasscom.umeng.fb.widget.InterceptTouchSwipeRefreshLayoutWarning:com.umeng.fb.fragment.FeedbackFragment:cantfindreferencedmethodvoidsetRefreshing(boolean)inprogramclasscom.umeng.fb.widget.InterceptTouchSwipeRefreshLayoutWarning:com.umeng.fb.fragment.FeedbackFragment 1: can’t find referenced method ‘android.content.res.Resources getResources()’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment 10:cantfindreferencedmethodvoidsetRefreshing(boolean)inprogramclasscom.umeng.fb.widget.InterceptTouchSwipeRefreshLayoutWarning:com.umeng.fb.fragment.FeedbackFragment 11: can’t find referenced method ‘android.support.v4.app.FragmentActivity getActivity()’ in program class com.umeng.fb.fragment.FeedbackFragment
Warning:com.umeng.fb.fragment.FeedbackFragment 5:cantfindreferencedmethodvoidstartActivityForResult(android.content.Intent,int)inprogramclasscom.umeng.fb.fragment.FeedbackFragmentWarning:com.umeng.fb.fragment.QuestionFragment:cantfindreferencedmethodandroid.support.v4.app.FragmentActivitygetActivity()inprogramclasscom.umeng.fb.fragment.QuestionFragmentWarning:com.umeng.fb.push.b:cantfindreferencedclasscom.umeng.message.PushAgentWarning:com.umeng.fb.push.b:cantfindreferencedclasscom.umeng.message.entity.UMessageWarning:com.umeng.fb.push.b:cantfindreferencedclasscom.umeng.message.PushAgentWarning:com.umeng.fb.push.b:cantfindreferencedclasscom.umeng.message.entity.UMessageWarning:com.umeng.fb.push.b 1: can’t find referenced class com.umeng.message.UmengMessageHandler
Warning:com.umeng.fb.push.b 1:cantfindreferencedclasscom.umeng.message.entity.UMessageWarning:com.umeng.fb.push.b 1: can’t find referenced class com.umeng.message.UmengMessageHandler
Warning:com.umeng.fb.push.b 1:cantfindreferencedclasscom.umeng.message.entity.UMessageWarning:com.umeng.fb.push.b 2: can’t find referenced class com.umeng.message.PushAgent
Note: com.mob.tools.utils.DeviceHelper: can’t find dynamically referenced class android.os.SystemProperties
Note: com.umeng.fb.push.FeedbackPush: can’t find dynamically referenced class com.umeng.message.UmengService
Note: the configuration keeps the entry point ‘com.baidu.mobads.AdView { void setListener(com.baidu.mobads.AdViewListener); }’, but not the descriptor class ‘com.baidu.mobads.AdViewListener’
Note: the configuration keeps the entry point ‘com.baidu.mobads.VideoAdView { void setListener(com.baidu.mobads.VideoAdViewListener); }’, but not the descriptor class ‘com.baidu.mobads.VideoAdViewListener’
Note: the configuration keeps the entry point ‘com.mob.tools.gui.MobViewPager { void setAdapter(com.mob.tools.gui.ViewPagerAdapter); }’, but not the descriptor class ‘com.mob.tools.gui.ViewPagerAdapter’
Note: the configuration keeps the entry point ‘com.mob.tools.gui.PullToRequestView { void setAdapter(com.mob.tools.gui.PullToRequestAdatper); }’, but not the descriptor class ‘com.mob.tools.gui.PullToRequestAdatper’
Note: the configuration keeps the entry point ‘com.mob.tools.gui.ScaledImageView { void setOnMatrixChangedListener(com.mob.tools.gui.ScaledImageViewOnMatrixChangedListener); }', but not the descriptor class 'com.mob.tools.gui.ScaledImageViewOnMatrixChangedListener’
Note: there were 8 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 5 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 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)
Warning:there were 15 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 27 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
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: 2.368 secs
Information:1 error
Information:40 warnings
Information:See complete output in console

那么解决这个问题很简单,只要消除这些警告就可以了。
你只需要在proguard-rules.pro这个文件中加入这样一句话

-ignorewarnings //通过这句话就可以取消掉系统中的这些警告。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值