当前位置: 首页 > 知识库问答 >
问题:

如何使用proGuard优化工具与xamarin形式

吕修筠
2023-03-14

我想减少大小的. apk文件,所以我检查启用ProGuard选项在Android项目的属性窗口,但得到编译时间错误

退出错误“java.exe”,代码为1。

我尝试了一些事情

  • 头部尺寸已经是1克了

日志:

1>------ Rebuild All started: Project: DirectionApp, Configuration: Release Any CPU ------
1>DirectionApp -> D:\New\West\ReadOut\DirectionApp\DirectionApp\DirectionApp\bin\Release\netstandard2.0\DirectionApp.dll
2>------ Rebuild All started: Project: DirectionApp.Android, Configuration: Release Any CPU ------
2>  DirectionApp.Android -> D:\New\West\ReadOut\DirectionApp\DirectionApp\DirectionApp.Android\bin\Release\DirectionApp.Android.dll
2>  No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5614e089" arbitrarily.
2>PROGUARD : warning : md5606e28f7ad4f2edd4892d456667ca4fb.EmdkWrapper: can't find superclass or interface com.symbol.emdk.EMDKManager$EMDKListener
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_EMDKListenerImplementor: can't find superclass or interface com.symbol.emdk.EMDKManager$EMDKListener
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find superclass or interface com.symbol.emdk.EMDKManager$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find superclass or interface com.symbol.emdk.ProfileManager$DataListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find superclass or interface com.symbol.emdk.barcode.BarcodeManager$ScannerConnectionListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_DataListenerImplementor: can't find superclass or interface com.symbol.emdk.barcode.Scanner$DataListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor: can't find superclass or interface com.symbol.emdk.barcode.Scanner$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.scanandpair.ScanAndPairManager_StatusListenerImplementor: can't find superclass or interface com.symbol.emdk.scanandpair.ScanAndPairManager$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_DataListenerImplementor: can't find superclass or interface com.symbol.emdk.simulscan.SimulScanReader$DataListerner
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_StatusListenerImplementor: can't find superclass or interface com.symbol.emdk.simulscan.SimulScanReader$StatusListerner
2>PROGUARD : warning : md5606e28f7ad4f2edd4892d456667ca4fb.EmdkWrapper: can't find referenced class com.symbol.emdk.EMDKManager$EMDKListener
2>PROGUARD : warning : md5606e28f7ad4f2edd4892d456667ca4fb.EmdkWrapper: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : md5606e28f7ad4f2edd4892d456667ca4fb.EmdkWrapper: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : md5606e28f7ad4f2edd4892d456667ca4fb.EmdkWrapper: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_EMDKListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager$EMDKListener
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_EMDKListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_EMDKListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_EMDKListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager$StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager$StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKBase
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKManager$StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.EMDKManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.EMDKBase
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find referenced class com.symbol.emdk.ProfileManager$DataListener
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find referenced class com.symbol.emdk.ProfileManager$ResultData
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find referenced class com.symbol.emdk.ProfileManager
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find referenced class com.symbol.emdk.ProfileManager$ResultData
2>PROGUARD : warning : mono.com.symbol.emdk.ProfileManager_DataListenerImplementor: can't find referenced class com.symbol.emdk.ProfileManager$ResultData
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.BarcodeManager$ScannerConnectionListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.BarcodeManager$ConnectionState
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.BarcodeManager
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.ScannerInfo
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.BarcodeManager$ConnectionState
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.ScannerInfo
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.BarcodeManager_ScannerConnectionListenerImplementor: can't find referenced class com.symbol.emdk.barcode.BarcodeManager$ConnectionState
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_DataListenerImplementor: can't find referenced class com.symbol.emdk.barcode.Scanner$DataListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_DataListenerImplementor: can't find referenced class com.symbol.emdk.barcode.Scanner
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_DataListenerImplementor: can't find referenced class com.symbol.emdk.barcode.ScanDataCollection
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_DataListenerImplementor: can't find referenced class com.symbol.emdk.barcode.ScanDataCollection
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor: can't find referenced class com.symbol.emdk.barcode.Scanner$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor: can't find referenced class com.symbol.emdk.barcode.Scanner
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor: can't find referenced class com.symbol.emdk.barcode.StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor: can't find referenced class com.symbol.emdk.barcode.StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.scanandpair.ScanAndPairManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.scanandpair.ScanAndPairManager$StatusListener
2>PROGUARD : warning : mono.com.symbol.emdk.scanandpair.ScanAndPairManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.scanandpair.ScanAndPairManager
2>PROGUARD : warning : mono.com.symbol.emdk.scanandpair.ScanAndPairManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.scanandpair.StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.scanandpair.ScanAndPairManager_StatusListenerImplementor: can't find referenced class com.symbol.emdk.scanandpair.StatusData
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_DataListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanReader$DataListerner
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_DataListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanReader
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_DataListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanData
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_DataListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanData
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_StatusListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanReader$StatusListerner
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_StatusListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanReader
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_StatusListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanStatusData
2>PROGUARD : warning : mono.com.symbol.emdk.simulscan.SimulScanReader_StatusListenerImplementor: can't find referenced class com.symbol.emdk.simulscan.SimulScanStatusData
2>PROGUARD : warning : there were 57 unresolved references to classes or interfaces.
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2550,3): error MSB6006: "java.exe" exited with code 1.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

如何解决此问题?我想修复上面的错误而不仅仅是警告。

共有1个答案

洪凯定
2023-03-14

遵循以下步骤

  • 首先,您需要添加proguard。cfg到您的android项目级别

如果您收到警告,那么您需要使用-dontwarn属性,如下所示

-dontwarn com.symbol.emdk.**
-dontwarn org.apache.http.**
-dontwarn com.appdynamics.eumagent.runtime.**

您必须删除/解决警告,因为这会导致上述错误。以上代码将删除所有警告
如果在执行应用程序后出现异常,则需要使用-keep属性。下面是必修课

-keep public class android.support.v7.widget.** { *; }
 类似资料:
  • 在发布模式下,当我只启用multi-dex时,我的应用程序大小为33.30MB,这相当大。经过一系列的研究,我意识到PROGUARD缩小了apk的大小。在我的解决方案中启用proguard,会出现此错误。PROGUARD的解决方案中可能缺少什么(缩小我的应用程序大小)? proguard.cfg

  • 我正在工作xamarin应用程序。当我启用"ProGuard"在Android属性,而建立的应用程序,我得到以下错误: 开发环境: Visual Studio 2015 Xamarin 4.0。4.4

  • 问题内容: 前一段时间,我使用了一种PNG优化服务,称为(我认为)“ smush it”。您向它提供了一个网络链接,它返回了所有PNG图像的zip压缩文件,它们的文件大小很好,很好地被弄脏了…… 我想在网站的图片上传过程中实现类似的优化功能;有谁知道我可以使用的预先存在的库(最好是PHP或Python)?简短的Google指示我使用了几种命令行样式工具,但我宁愿不走这条路。 问题答案: 用PHP执

  • ->这是progaurd-rules.pro

  • 如果经过之前章节的一系列优化之后,数据确实超过了集群能承载的能力,除了拆分集群以外,最后就只剩下一个办法了:清除废旧索引。 为了更加方便的做清除数据,合并 segment,备份恢复等管理任务,Elasticsearch 在提供相关 API 的同时,另外准备了一个命令行工具,叫 curator 。curator 是 Python 程序,可以直接通过 pypi 库安装: pip install ela

  • 本文向大家介绍Android Zipalign工具优化Android APK应用,包括了Android Zipalign工具优化Android APK应用的使用技巧和注意事项,需要的朋友参考一下        生成的Android应用APK文件最好进行优化,因为APK包的本质是一个zip压缩文档,经过优化能使包内未压缩的数据有序的排列,从而减少应用程序运行时的内存消耗。我们可以使用Zipalign