在构建应用程序时让 java.exe 以代码 2 退出
Getting java.exe exited with code 2 while building the app
我将 android sdk api 版本从 27 升级到 28,并在编译构建时开始获取 "java.exe" exited with code 2
。
输出:
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2667,3): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="SQLitePCLRaw.batteries_v2" culture="neutral" publicKeyToken="8226ea5df37bcae9" /><bindingRedirect oldVersion="0.0.0.0-1.1.13.388" newVersion="1.1.13.388" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="SQLitePCLRaw.core" culture="neutral" publicKeyToken="1488e028ca7ab535" /><bindingRedirect oldVersion="0.0.0.0-1.1.13.388" newVersion="1.1.13.388" /></dependentAssembly></assemblyBinding>
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [__reference__commons-io-2.4.jar:META-INF/LICENSE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [__reference__commons-io-2.4.jar:META-INF/NOTICE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [__reference__commons-lang-2.6.jar:META-INF/LICENSE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [__reference__commons-lang-2.6.jar:META-INF/NOTICE.txt])
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2610,3): error MSB6006: "java.exe" exited with code 2.
我找不到根本原因。
编辑
我在我的应用程序中启用了 multidex,但我仍然遇到同样的问题。
我找到了问题的答案。答案不是那么好,但它有效。我使用的是 visual studio 2017,android 9 有一些问题。我将其更新为 visual studio 2019,应用程序开始正常构建。
所以我有这个,在我的例子中,它只是意味着我为带有签名证书的 Java 密钥库提供的密码是错误的!我确实认为他们可以在这种情况下给出更具描述性的错误消息,但显然不会。
我应该补充一点,这是来自 CI 使用 msbuild 的 CLI 版本执行脚本构建的进程,但怀疑这是否会有所不同。
我将 android sdk api 版本从 27 升级到 28,并在编译构建时开始获取 "java.exe" exited with code 2
。
输出:
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2667,3): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="SQLitePCLRaw.batteries_v2" culture="neutral" publicKeyToken="8226ea5df37bcae9" /><bindingRedirect oldVersion="0.0.0.0-1.1.13.388" newVersion="1.1.13.388" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="SQLitePCLRaw.core" culture="neutral" publicKeyToken="1488e028ca7ab535" /><bindingRedirect oldVersion="0.0.0.0-1.1.13.388" newVersion="1.1.13.388" /></dependentAssembly></assemblyBinding>
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [__reference__commons-io-2.4.jar:META-INF/LICENSE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [__reference__commons-io-2.4.jar:META-INF/NOTICE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [__reference__commons-lang-2.6.jar:META-INF/LICENSE.txt])
1>CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [__reference__commons-lang-2.6.jar:META-INF/NOTICE.txt])
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2610,3): error MSB6006: "java.exe" exited with code 2.
我找不到根本原因。
编辑
我在我的应用程序中启用了 multidex,但我仍然遇到同样的问题。
我找到了问题的答案。答案不是那么好,但它有效。我使用的是 visual studio 2017,android 9 有一些问题。我将其更新为 visual studio 2019,应用程序开始正常构建。
所以我有这个,在我的例子中,它只是意味着我为带有签名证书的 Java 密钥库提供的密码是错误的!我确实认为他们可以在这种情况下给出更具描述性的错误消息,但显然不会。
我应该补充一点,这是来自 CI 使用 msbuild 的 CLI 版本执行脚本构建的进程,但怀疑这是否会有所不同。