Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android上Scala的ant构建中dex失败_Android_Scala_Ant_Dex - Fatal编程技术网

Android上Scala的ant构建中dex失败

Android上Scala的ant构建中dex失败,android,scala,ant,dex,Android,Scala,Ant,Dex,注意:对项目稍作修改后,我就可以使用以下内容再次构建:。对于在Android上构建Scala有困难的人来说,这是一个好的开始。 我正在使用ant在Android SDK的第12版中构建scala(按照这里的说明进行)。在升级到最新的Android SDK(第14版)之前,一切都进行得很顺利。现在我得到了以下输出: Buildfile: /Users/matt/Documents/workspace/ScalaEclipseAndroid/build.xml -set-mode-check: -s

注意:对项目稍作修改后,我就可以使用以下内容再次构建:。对于在Android上构建Scala有困难的人来说,这是一个好的开始。

我正在使用ant在Android SDK的第12版中构建scala(按照这里的说明进行)。在升级到最新的Android SDK(第14版)之前,一切都进行得很顺利。现在我得到了以下输出:

Buildfile: /Users/matt/Documents/workspace/ScalaEclipseAndroid/build.xml
-set-mode-check:
-set-debug-files:
-set-debug-mode:
-debug-obfuscation-check:
-setup:
     [echo] Gathering info for ScalaEclipseAndroid...
    [setup] Android SDK Tools Revision 14
    [setup] Project Target: Google APIs
    [setup] Vendor: Google Inc.
    [setup] Platform Version: 2.1
    [setup] API level: 7
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] ------------------
    [setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (4) is lower than the project target API level (7)
-build-setup:
     [echo] Creating output directories if needed...
-pre-build:
-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No aidl files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No renderscript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] No changed resources. R.java and Manifest.java untouched.
-pre-compile:
-compile:
   [scalac] Compiling 0 scala and 1 java source files to /Users/matt/Documents/workspace/ScalaEclipseAndroid/bin/classes
    [javac] /Development/android-sdk-mac_x86/tools/ant/build.xml:615: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
   [scalac] Compiling 0 scala and 1 java source files to /Users/matt/Documents/workspace/ScalaEclipseAndroid/bin/classes
-post-compile:
-obfuscate:
-dex:
      [dex] Converting compiled files and external libraries into /Users/matt/Documents/workspace/ScalaEclipseAndroid/bin/classes.dex...
       [dx] UNEXPECTED TOP-LEVEL ERROR:
       [dx] java.lang.AssertionError
       [dx]     at com.android.dx.dex.code.OutputFinisher.findExpandedOpcodeForInsn(OutputFinisher.java:525)
       [dx]     at com.android.dx.dex.code.OutputFinisher.calculateReservedCount(OutputFinisher.java:466)
       [dx]     at com.android.dx.dex.code.OutputFinisher.reserveRegisters(OutputFinisher.java:402)
       [dx]     at com.android.dx.dex.code.OutputFinisher.finishProcessingAndGetList(OutputFinisher.java:358)
       [dx]     at com.android.dx.dex.code.DalvCode.finishProcessingIfNecessary(DalvCode.java:108)
       [dx]     at com.android.dx.dex.code.DalvCode.getInsns(DalvCode.java:185)
       [dx]     at com.android.dx.dex.file.CodeItem.place0(CodeItem.java:223)
       [dx]     at com.android.dx.dex.file.OffsettedItem.place(OffsettedItem.java:242)
       [dx]     at com.android.dx.dex.file.MixedItemSection.placeItems(MixedItemSection.java:312)
       [dx]     at com.android.dx.dex.file.DexFile.toDex0(DexFile.java:543)
       [dx]     at com.android.dx.dex.file.DexFile.toDex(DexFile.java:216)
       [dx]     at com.android.dx.command.dexer.Main.writeDex(Main.java:574)
       [dx]     at com.android.dx.command.dexer.Main.run(Main.java:218)
       [dx]     at com.android.dx.command.dexer.Main.main(Main.java:174)
       [dx]     at com.android.dx.command.Main.main(Main.java:95)

BUILD FAILED
/Development/android-sdk-mac_x86/tools/ant/build.xml:772: The following error occurred while executing this line:
/Development/android-sdk-mac_x86/tools/ant/build.xml:774: The following error occurred while executing this line:
/Development/android-sdk-mac_x86/tools/ant/build.xml:786: The following error occurred while executing this line:
/Development/android-sdk-mac_x86/tools/ant/build.xml:248: null returned: 3

错误本身并没有包含太多的信息,我也不是Ant的高手。如果有人能解释一下这个问题,我们将不胜感激。

您可能会遇到dex文件中方法总数的65535限制:。在这种情况下,使用ProGuard收缩和优化编译后的代码可能会有所帮助,正如您提到的页面上所建议的那样。

来自问题:对项目稍作修改后,我就可以使用以下方法再次构建:。对于在Android上构建Scala有困难的人来说,这是一个好的开始。

这看起来像是dx代码中的一个断言,听起来像是dx中的一个bug。我将从堆栈跟踪中快速查看代码中的该位置,看看是否可以确定交易不在哪里r14的源代码当前可用,并且OutputFinisher类的源代码似乎与堆栈跟踪不匹配,这意味着它在r14中被修改。所以除了这似乎是r14中引入的dx中的一个bug之外,我没什么可说的了。如果你真的想尝试跟踪它,你可以反编译dx jar,看看抛出断言的代码,看看是否可以确定原因。谢谢你提供的信息和异常快速的响应。我想这可能也是dx中的一个bug。还有