我遇到错误:“ javac.exe”退出,代码3

时间:2019-06-23 20:09:03

标签: java android

我创建了一个新项目并尝试进行构建,但出现此错误:“ javac.exe”退出,代码3。 输出错误为:

Creating C:\Users\Пользователь\AppData\Local\Xamarin.Android\Cache\Mono.Android.Platform.ApiLevel_28.apk

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(417,2): warning : One or more errors occurred.

1>  App5.Android -> C:\Users\Пользователь\source\repos\App5\App5\App5.Android\bin\Debug\App5.Android.dll

1>  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=b77a5c561934e089" arbitrarily.

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2664,3): error MSB6006: "javac.exe" exited with code 3.

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========  
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

1 个答案:

答案 0 :(得分:0)

简单搜索“ android无法解决彼此之间的冲突”,显示了讨论该问题的论坛帖子here。以下指向官方Xamarin bug report的链接显示了the following solution

将此添加到您的app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>