Xamarin Java.exe退出,代码为1(Proguard问题) [英] Xamarin Java.exe exited with code 1 (Proguard Issue)

查看:87
本文介绍了Xamarin Java.exe退出,代码为1(Proguard问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与Xamarin的另一天!甚至无法构建我的第一个Hello World项目!不足为奇吧?

Another day with Xamarin! Can't even build my first Hello World project! Not surprising, huh?

因此,新建了一个新的Xamarin.Android空白项目.启用 ProGuard ,链接到仅SDK组件,然后继续构建项目.还有 wallah !! !有个错误!(等等,我不应该感到惊讶,对吧?毕竟是Xamarin).这是错误:

So, fresh new Xamarin.Android blank project. Enabled ProGuard, link to SDK Assemblies Only and went on building the project. And wallah!! There's an error!(Wait, i shouldn't be surprised, right? After all, it's Xamarin). Here's the error :

"java.exe"以代码1退出

"java.exe" exited with code 1

双击异常会打开Xamarin.Android.Common.Targets文件,并指向ProGuard标记,如下所示:

Double-clicking the exception opens up Xamarin.Android.Common.Targets file and points to the ProGuard tag which is as follows :

<Proguard
Condition="'$(AndroidEnableProguard)' == 'True' and '$(_ProguardProjectConfiguration)' != ''"
ProguardJarPath="$(ProguardJarPath)"
AndroidSdkDirectory="$(_AndroidSdkDirectory)"
JavaToolPath="$(JavaToolPath)"
ProguardToolPath="$(ProguardToolPath)"
ToolExe="$(ProguardToolExe)"
UseProguard="$(UseProguard)"
JavaPlatformJarPath="$(JavaPlatformJarPath)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
AcwMapFile="$(_AcwMapFile)"
ProguardCommonXamarinConfiguration="$(IntermediateOutputPath)proguard\proguard_xamarin.cfg"
ProguardGeneratedReferenceConfiguration="$(_ProguardProjectConfiguration)"
ProguardGeneratedApplicationConfiguration="$(IntermediateOutputPath)proguard\proguard_project_primary.cfg"
ProguardConfigurationFiles="$(ProguardConfigFiles)"
JavaLibrariesToEmbed="@(_JarsToProguard);@(_InstantRunJavaReference)"
ExternalJavaLibraries="@(AndroidExternalJavaLibrary)"
DoNotPackageJavaLibraries="@(_ResolvedDoNotPackageAttributes)"
ProguardJarOutput="$(IntermediateOutputPath)proguard\__proguard_output__.jar"
EnableLogging="$(ProguardEnableLogging)"
DumpOutput="$(IntermediateOutputPath)proguard\dump.txt"
PrintSeedsOutput="$(IntermediateOutputPath)proguard\seeds.txt"
PrintUsageOutput="$(IntermediateOutputPath)proguard\usage.txt"
PrintMappingOutput="$(IntermediateOutputPath)proguard\mapping.txt"
ProguardInputJarFilter="$(_AndroidProguardInputJarFilter)"
/>

因此,我最好的猜测是这可能是与 ProGuard 相关的问题.因此,搜索了google并应用了我到目前为止找到的所有修复程序:

So, my best guess was that it might be a ProGuard related issue. So, searched up google and applied all fixes i found so far :

  • 更新的Android SDK
  • 将Java堆大小设置为1G(甚至5G)
  • 已启用Multi-Dex
  • 更新后的ProGuard
  • 在解决方案中创建了一个新的proguard.cfg文件(当然,将build action设置为ProGuardConfiguration并添加了必要的自定义行.
  • Updated Android SDK
  • Set Java heap size to 1G(and even 5G)
  • Enabled Multi-Dex
  • Updated ProGuard
  • Created a new proguard.cfg file in solution(of course set build action to ProGuardConfiguration and added custom lines that are necessary.

但是,仍然存在指向同一ProGuard标签的相同错误.现在,在有人开始抨击我说我可以弄乱proguard配置文件之前,这是它的链接:

But still, same error pointing to the same ProGuard tag. Now before anybody starts bashing me saying i could've messed up the proguard configuratiom file, here's the link to it:

  • ProGuard.cfg
  • Build Output From Visual Studio 2017

我已经读到这是Xamarin中非常普遍的问题.因此,我想也许有人想出了一个真正可行的解决方案!.那么,关于我可能会缺少的任何修正或想法?

I have read that this is a very common issue in Xamarin. So, i guess, somebody might have come up with a solution that really works!. So, any fixes or ideas on what i might be missing?

推荐答案

  1. 确保您添加的proguard文件不是Unicode文本文件(U + FEFF字节顺序标记(BOM)),因为proguard将会失败...

  1. Make sure that the proguard file you added is NOT a Unicode text file (U+FEFF byte order mark (BOM)) as proguard will fail...

启用诊断.级别的MSBuild日志记录并获取完整的错误消息.

Enable diag. level logging for MSBuild and get the full error message.

Proguard已被Google的R8取代

Proguard is being replaced by Google's R8

如果您使用的是最新版本的Xamarin,请以以下博客文章开头:

If you are using the latest version of Xamarin, refer to this blog post as a start:

有关各种D8/R8项目配置的详细信息,可以在Xamarin.Android存储库中找到:

Detailed info on the various D8/R8 project configurations can be found in the Xamarin.Android repo here:

这篇关于Xamarin Java.exe退出,代码为1(Proguard问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆