我正在开发android app
。最近,我从项目中删除了activation.jar
和mail.jar
,然后将其添加回来。将它们添加回来后,尝试运行我的application
我收到以下错误:
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'
com.android.build.api.transform.TransformException:
com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/mimetypes.default
File1: C:\Android\Workspace\WeekendMovieRating\app\libs\activation.jar
File2: C:\Android\Workspace\WeekendMovieRating\app\libs\mail.jar
我用Google搜索解决方案并尝试了以下解决方案;
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
}
我在gradle.properties
中添加了上述代码,并尝试运行application
但仍然收到相同的error
。
然后我在观察我的error
消息之后添加了以下代码:
exclude 'META-INF/mimetypes.default'
exclude 'META-INF/mailcap.default'
添加上述行后,它显示为BUILD SUCCESSFULL
,但显示为240 errors
。
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.sun.mail.imap.DefaultFolder$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
...
...
...
Error:indicate that it is *not* an inner class.
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:fullDebugBuildInfoGenerator
:app:assembleDebug
Information:BUILD SUCCESSFUL
Information:Total time: 1 mins 47.694 secs
Information:240 errors
Information:0 warnings
请发表您的回答。提前致谢
答案 0 :(得分:0)
您获得的错误与Proguard相关,与您最初发布的重复文件问题无关。
您应该相应地更新您的标题和说明以反映出来。
除非您提供有关proguard问题的更详细信息,否则很难解决。
您可以查看此similar问题,了解需要添加到proguard配置中的内容。
答案 1 :(得分:0)
packagingOptions {
pickFirst 'META-INF/mailcap.default'
pickFirst 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/mimetypes.default'
exclude 'META-INF/mailcap.default'
}
将此用于包装选项