<small id='gtJsj'></small><noframes id='gtJsj'>

<i id='gtJsj'><tr id='gtJsj'><dt id='gtJsj'><q id='gtJsj'><span id='gtJsj'><b id='gtJsj'><form id='gtJsj'><ins id='gtJsj'></ins><ul id='gtJsj'></ul><sub id='gtJsj'></sub></form><legend id='gtJsj'></legend><bdo id='gtJsj'><pre id='gtJsj'><center id='gtJsj'></center></pre></bdo></b><th id='gtJsj'></th></span></q></dt></tr></i><div id='gtJsj'><tfoot id='gtJsj'></tfoot><dl id='gtJsj'><fieldset id='gtJsj'></fieldset></dl></div>

  • <legend id='gtJsj'><style id='gtJsj'><dir id='gtJsj'><q id='gtJsj'></q></dir></style></legend>
      <tfoot id='gtJsj'></tfoot>
      • <bdo id='gtJsj'></bdo><ul id='gtJsj'></ul>

        Gradle:如何从 JScience jar 依赖项中排除 javax.realtime 包(多个 dex 定义)

        Gradle: How to exclude javax.realtime package from JScience jar dependency (Multiple dex define)(Gradle:如何从 JScience jar 依赖项中排除 javax.realtime 包(多个 dex 定义))
          <tbody id='lfvIT'></tbody>

            • <small id='lfvIT'></small><noframes id='lfvIT'>

              <legend id='lfvIT'><style id='lfvIT'><dir id='lfvIT'><q id='lfvIT'></q></dir></style></legend>
                • <bdo id='lfvIT'></bdo><ul id='lfvIT'></ul>
                  <i id='lfvIT'><tr id='lfvIT'><dt id='lfvIT'><q id='lfvIT'><span id='lfvIT'><b id='lfvIT'><form id='lfvIT'><ins id='lfvIT'></ins><ul id='lfvIT'></ul><sub id='lfvIT'></sub></form><legend id='lfvIT'></legend><bdo id='lfvIT'><pre id='lfvIT'><center id='lfvIT'></center></pre></bdo></b><th id='lfvIT'></th></span></q></dt></tr></i><div id='lfvIT'><tfoot id='lfvIT'></tfoot><dl id='lfvIT'><fieldset id='lfvIT'></fieldset></dl></div>
                  <tfoot id='lfvIT'></tfoot>

                  本文介绍了Gradle:如何从 JScience jar 依赖项中排除 javax.realtime 包(多个 dex 定义)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在我的 Android 应用程序中使用 Gradle,我想使用 JScience 库依赖项.我以这种方式添加了库:

                  I'm using Gradle in my Android application an I would like to use the JScience library dependency. I have added the library this way:

                  dependencies {
                      compile fileTree(dir: 'libs', include: '*.jar')
                  
                      compile 'org.jscience:jscience:4.3.1'
                  
                      testCompile group: 'junit', name: 'junit', version: '4.11'
                  }
                  

                  但在编译时出现错误:

                  UNEXPECTED TOP-LEVEL EXCEPTION:
                  com.android.dex.DexException: Multiple dex files define Ljavax/realtime/MemoryArea;
                      at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
                      at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
                      at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
                      at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
                      at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
                      at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
                      at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
                      at com.android.dx.command.dexer.Main.run(Main.java:230)
                      at com.android.dx.command.dexer.Main.main(Main.java:199)
                      at com.android.dx.command.Main.main(Main.java:103)
                  

                  这是因为在项目中复制了javax.realtime包,一个是JDK的一部分,一个是Jscience库的一部分.我试图在 Gradle 中以这种方式从 Jscience 库中删除这个包:

                  This is caused because of duplicating javax.realtime packages in project, one is a part of JDK, and the second one is in the Jscience library. I have tried to remove this package from Jscience library this way in Gradle:

                  sourceSets {
                      main {
                          java {
                              exclude 'javax/realtime/**'
                          }
                      }
                  }
                  
                  configurations {
                      all*.exclude group: 'javax.realtime'
                  }
                  

                  但这并没有帮助.因此,该包仍然存在于依赖项中.

                  But that didn't help. So, that package is still exists in dependencies.

                  有什么方法可以在编译时从 jar 中排除一个包?

                  Is there any way how I can exclude a package from jar on compile time?

                  推荐答案

                  如果有人需要,问题出在 JScience 库的 Javolution 依赖项中.他们都有一个 javax.runtime 包.排除 Javolution 为我解决了这个问题.

                  In case anybody needed, the problem was in Javolution dependency from JScience library. They both do hava a javax.runtime package. Excluding the Javolution has fixed the issue for me.

                  compile ('org.jscience:jscience:4.3.1') {
                      exclude group: 'org.javolution', module: 'javolution'
                  }
                  

                  这篇关于Gradle:如何从 JScience jar 依赖项中排除 javax.realtime 包(多个 dex 定义)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Maven JAVA_HOME environment variable is not defined correctly, but it is(Maven JAVA_HOME 环境变量未正确定义,但它是)
                  Java System Environment Variable(Java 系统环境变量)
                  Java -classpath option(Java -classpath 选项)
                  Read environment variable in SpringBoot(在 SpringBoot 中读取环境变量)
                  Tomcat 8 - context.xml use Environment Variable in Datasource(Tomcat 8 - context.xml 在数据源中使用环境变量)
                  Issue with JAVA_HOME(JAVA_HOME 的问题)

                • <small id='nd9Wc'></small><noframes id='nd9Wc'>

                      <legend id='nd9Wc'><style id='nd9Wc'><dir id='nd9Wc'><q id='nd9Wc'></q></dir></style></legend><tfoot id='nd9Wc'></tfoot>

                        <i id='nd9Wc'><tr id='nd9Wc'><dt id='nd9Wc'><q id='nd9Wc'><span id='nd9Wc'><b id='nd9Wc'><form id='nd9Wc'><ins id='nd9Wc'></ins><ul id='nd9Wc'></ul><sub id='nd9Wc'></sub></form><legend id='nd9Wc'></legend><bdo id='nd9Wc'><pre id='nd9Wc'><center id='nd9Wc'></center></pre></bdo></b><th id='nd9Wc'></th></span></q></dt></tr></i><div id='nd9Wc'><tfoot id='nd9Wc'></tfoot><dl id='nd9Wc'><fieldset id='nd9Wc'></fieldset></dl></div>
                          <tbody id='nd9Wc'></tbody>

                        • <bdo id='nd9Wc'></bdo><ul id='nd9Wc'></ul>