"&的java.exe QUOT;退出代码2 Xamarin.Android项目 [英] "java.exe" exited with code 2 Xamarin.Android project

查看:240
本文介绍了"&的java.exe QUOT;退出代码2 Xamarin.Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有我的Xamarin.Android项目,其中包含几个库。当我尝试构建时,我收到一条错误,其中java.exe退出代码2.

so I have my Xamarin.Android project which contains several libraries. When I try to build I receive an error which says "java.exe" exited with code 2.

经过几个小时的Google研究后,我发现我可以启用Multidex 。
根据Jon Doublas的博客文章,我做了上面提到的步骤。
http://www.jon-douglas。 com / 2016/09/05 / xamarin-android-multidex /

After some hours of google research I found out that I could enable Multidex. According to the blog entry of Jon Doublas I did the steps mentioned. http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/

根据博客文章Android API Level> 21处理Multidex本身。
我的经验是,它没有。我在API级别25上构建并使用相同的信息一次又一次地获得相同的错误。
文章中的步骤没有帮助。看起来像Xamarin.Android不支持Multidex。

According to the blog entry Android API Level > 21 handles Multidex itself. Well my experience is that it does not. I am building on API Level 25 and get the same error again and again with the same information. The steps in the article do not help. It seems like Xamarin.Android does not support Multidex.

您似乎必须自己处理Multidex,但我找不到任何有效的解决方案。有没有人找到一个有效的解决方案?

It seems like you have to handle Multidex by yourself but I haven't found any solution which is working. Dos anybody found a solution which works?

我正在使用Xamarin 4.6和Visual Studio 2017。

I am using Xamarin 4.6 and Visual studio 2017.

推荐答案

在我的项目中搜索大约20个小时后找到答案..
所以这里是解决问题的步骤java.exe退出代码2

Found the answer after about 20 hours of searching in my project.. So here are the steps to resolve the problem "java.exe" exited with code 2

1)更改链接中描述的MainDexClasses.bat:

1) Change the MainDexClasses.bat as descriped in the link:

http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/

2)确保您已在Android应用程序中启用Multi-Dex选项 - !!!如果MultiDex设置为true,请查看.csprj文件(在我的情况下,即使我启用Multi-Dex也不行)

2) Make sure you have enabled Multi-Dex Option in your Android Application - !!! Have a look at the .csprj file if MultiDex is set to true (in my case it wasn't even if i enabled Multi-Dex)

3)添加以下内容部分在你的AndroidManifest文件中

3) Add the following part in your AndroidManifest file

<application android:name="android.support.multidex.MultiDexApplication"></application>

这将告诉你的android-project实际使用给定的MultiDex-Option。

This will tell your android-project to actually use the MultiDex-Option given.

在干净和构建之后,我能够按原样运行我的应用程序。

After a clean and build I was able to run my application as it is.

这篇关于&QUOT;&的java.exe QUOT;退出代码2 Xamarin.Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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