使用 Multidex 构建 xamarin.android 时 CREATEMULTIDEXMAINDEXCLASSLIST 错误 [英] CREATEMULTIDEXMAINDEXCLASSLIST error when building xamarin.android using Multidex

查看:44
本文介绍了使用 Multidex 构建 xamarin.android 时 CREATEMULTIDEXMAINDEXCLASSLIST 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑 - 减少到问题的根源

启用 Multi-Dex 时出现此错误.

I'm getting this error when Multi-Dex is enabled.

CREATEMULTIDEXMAINDEXCLASSLIST : 错误:参数号 2 中的.jar"之前需要类路径分隔符:"

CREATEMULTIDEXMAINDEXCLASSLIST : error : Expecting class path separator ':' before '.jar' in argument number 2

我已经追踪到这个 jar 文件包含在 ProGuard 命令行中:

I have tracked it down to this jar file being included in the ProGuard command line:

obj/Debug/__library_projects__/DeviceAPI_Android/library_project_imports/DeviceAPI_Android.Jars.cw-deviceapi(2016.05.16).jar

导致错误的是文件名中的括号.我已经通过在终端提示中运行命令并删除了这个 jar 文件来证明这一点,并且一切正常.

It's the brackets in the file name which are causing the error. I've proved this by running the command in a terminal prompt with this jar file removed, and all works fine.

那么问题是——这个文件来自哪里?是在包里吗?我在那里看不到.

So the question - where is this file coming from? Is it in Packages? I can't see it there.

如果我能找到我应该能够更正名称并构建项目.

If I can find that I should be able to correct the name and build the project.

我已将其追踪到名为 DeviceAPI_Android.dll 的第 3 方绑定库,该库封装了一个用于控制硬件条码扫描器的 jar 文件.jar 文件的文件名中确实包含括号和日期.

I've tracked it down to a 3rd party binding library called DeviceAPI_Android.dll, which wraps a jar file for controlling the hardware barcode scanner. The jar file does indeed have the brackets and date in its filename.

所以解决方案是以下一种或多种:

So the solution is one or more of:

  • 从供应商处获取新版本的绑定库,并提供一个更好命名的 jar 文件.

  • Get a new version of the binding library from the supplier with a better named jar file.

自己用一个更好命名的 jar 文件重建库.可能有问题,因为我必须从头开始创建转换等.

Rebuild the library myself with a better named jar file. Potentially problematic because I'll have to create the transforms etc. from scratch.

调整构建工具/makefile,使 ProGuard 命令行更能适应奇怪命名的 jar 文件.

Adjust the build tooling/makefile to make the ProGuard command line more resilient to strangely named jar files.

演示该问题的示例项目位于 GitHub 此处.

A sample project demonstrating the problem is on GitHub here.

版本信息:=== 适用于 Mac 的 Visual Studio 社区 2017 ===

Version Information: === Visual Studio Community 2017 for Mac ===

7.1 版(版本 1297)安装 UUID:650b4c91-c7f5-4ee5-ad70-6f178f314906运行:单声道 5.2.0.215 (d15-3/da80840)(64 位)GTK+ 2.24.23(罗利主题)

Version 7.1 (build 1297) Installation UUID: 650b4c91-c7f5-4ee5-ad70-6f178f314906 Runtime: Mono 5.2.0.215 (d15-3/da80840) (64-bit) GTK+ 2.24.23 (Raleigh theme)

Package version: 502000215

=== NuGet ===

=== NuGet ===

版本:4.3.0.2418

Version: 4.3.0.2418

=== .NET 核心 ===

=== .NET Core ===

运行时:未安装SDK:未安装MSBuild SDK:/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

Runtime: Not installed SDK: Not installed MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

=== Xamarin.Profiler ===

版本:1.5.5位置:/Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Version: 1.5.5 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

=== Xamarin.Android ===

版本:7.4.0.21(Visual Studio 社区)Android SDK:/Users/jameslavery/Library/Developer/Xamarin/android-sdk-macosx支持的安卓版本:2.3(API 级别 10)4.0.3(API 级别 15)4.1(API 级别 16)4.3(API 级别 18)4.4(API 级别 19)5.0(API 级别 21)5.1(API 级别 22)6.0(API 级别 23)7.0(API 级别 24)7.1(API 级别 25)

Version: 7.4.0.21 (Visual Studio Community) Android SDK: /Users/jameslavery/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 2.3 (API level 10) 4.0.3 (API level 15) 4.1 (API level 16) 4.3 (API level 18) 4.4 (API level 19) 5.0 (API level 21) 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25)

SDK 工具版本:25.2.5SDK平台工具版本:25.0.5SDK 构建工具版本:25.0.3

SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.5 SDK Build Tools Version: 25.0.3

Java SDK:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Homejava版本1.8.0_144"Java(TM) SE 运行时环境(构建 1.8.0_144-b01)Java HotSpot(TM) 64 位服务器 VM(构建 25.144-b01,混合模式)

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Android Designer EPL 代码可在此处获得:https://github.com/xamarin/AndroidDesigner.EPL

Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== 苹果开发者工具 ===

=== Apple Developer Tools ===

Xcode 8.0 (11246)构建 8A218a

Xcode 8.0 (11246) Build 8A218a

=== Xamarin.iOS ===

=== Xamarin.iOS ===

版本:10.12.0.20(Visual Studio 社区)哈希:80b8487d分支:d15-3构建日期:2017-08-18 16:07:26-0400

Version: 10.12.0.20 (Visual Studio Community) Hash: 80b8487d Branch: d15-3 Build date: 2017-08-18 16:07:26-0400

=== Xamarin.Mac ===

=== Xamarin.Mac ===

版本:3.6.0.19(Visual Studio 社区)

Version: 3.6.0.19 (Visual Studio Community)

=== Xamarin 检查器 ===

=== Xamarin Inspector ===

版本:1.2.2哈希:b71b035分支:d15-1构建日期:2017 年 4 月 21 日星期五 17:57:12 GMT

Version: 1.2.2 Hash: b71b035 Branch: d15-1 Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== 构建信息 ===

=== Build Information ===

版本号:701001297Git 修订版:9c5299666538b2f8baf501418a5c064d784d64da构建日期:2017-08-07 11:29:35-04Xamarin 插件:3bb0c32a14f1b7e368bf5ac53a84c3581c019391建造车道:monodevelop-lion-d15-3

Release ID: 701001297 Git revision: 9c5299666538b2f8baf501418a5c064d784d64da Build date: 2017-08-07 11:29:35-04 Xamarin addins: 3bb0c32a14f1b7e368bf5ac53a84c3581c019391 Build lane: monodevelop-lion-d15-3

=== 操作系统 ===

=== Operating System ===

Mac OS X 10.11.6达尔文 15.6.0 达尔文内核版本 15.6.02016 年 6 月 23 日星期四 18:25:34 PDT根:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

Mac OS X 10.11.6 Darwin 15.6.0 Darwin Kernel Version 15.6.0 Thu Jun 23 18:25:34 PDT 2016 root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

=== 启用用户安装的插件 ===

=== Enabled user installed addins ===

LiveXAML 1.0Redth 的插件 1.0.9

LiveXAML 1.0 Redth's Addins 1.0.9

推荐答案

这是因为有一个绑定库,其中有一个嵌入的 Jar 文件,文件名中带有方括号 - 这导致 ProGuard 的命令行失败.

This is because there is a binding library with an embedded Jar file with brackets in its filename - which cause the command line for ProGuard to fail.

@jondouglas 已为此提交 Xamarin 错误 59237.希望修复将是使 ProGuard 的命令行对奇怪命名的文件更具弹性.

@jondouglas has submitted Xamarin bug 59237 for this. Hopefully the fix will be to make the command line for ProGuard more resilient to strangely named files.

与此同时,我将不得不获取一个更新的绑定库,其中嵌入的 jar 文件的名称中没有带括号(或其他破坏命令行的字符).

In the meantime, I will have to get hold of an updated binding library with the embedded jar file not having a name with parentheses (or other character which breaks a command line) in it.

感谢@jondouglas 帮助诊断问题.

Thanks to @jondouglas for his help in diagnosing the problem.

这篇关于使用 Multidex 构建 xamarin.android 时 CREATEMULTIDEXMAINDEXCLASSLIST 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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