java - Android 项目构建失败 javax/xml/stream/events/StartElement.class

标签 java android android-studio gradle

我正在使用 Comriva 库将 MFCC 特征提取到我的语音识别项目中。我已经将 comriva 核心包导入到我的项目中。当我厌倦了构建它时,我在 gradle 中遇到了这个错误,

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex UP-TO-DATE
:app:shrinkDebugMultiDexComponents UP-TO-DATE
:app:createDebugMainDexClassList UP-TO-DATE
:app:dexDebug
trouble processing "javax/xml/stream/events/StartElement.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 5.524 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

到目前为止,我没有像 simple-xml 那样包含任何 xml 库。

这是我的 gradle.build 文件,

apply plugin: 'com.android.application'

android {

    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "info.androidhive.sleepApp"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile files('libs/jl1.0.jar')

    compile files('libs/commons-logging-api.jar')
    compile files('libs/cp.jar')
            compile files('libs/http-2.2.1.jar')
            compile files('libs/jama-1.0.2.jar')
            compile files('libs/jl1.0.jar')
            compile files('libs/jogg-0.0.7.jar')
            compile files('libs/lucene-analyzers-3.0.0.jar')
            compile files('libs/lucene-core-3.0.0.jar')
            compile files('libs/lucene-queries-3.0.0.jar')
            compile files('libs/lucene-queryparser-3.0.0.jar')
            compile files('libs/lucene-snowball-3.0.3.jar')
            compile files('libs/jorbis-0.0.15.jar')
            compile files('libs/mdsj.jar')
            compile files('libs/tritonus_remaining.jar')
            compile files('libs/tritonus_share.jar')
            compile files('libs/wstx-lgpl-3.0.1.jar')
            compile files('libs/weka-stable-3.6.13.jar')
            compile files('libs/stax-api-1.0.jar')
            compile files('libs/mp3spi1.9.4.jar')
}

请帮我解决这个问题。

最佳答案

我发现问题是 stax-api-1.0.jar,它包括 javax.xml.stream.events.* 类,在删除 jar 后我能够成功构建它。这个 jar 是随 comriva 一起来的,这就是为什么我没有注意到它。

关于java - Android 项目构建失败 javax/xml/stream/events/StartElement.class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35449618/

相关文章:

java - 为什么 Fortify 将其标记为未发布的资源?

java - 使用Java,如何设置数组以将下一个用户输入存储在下一个索引/中

java - 验证是否可以与 Controller 中增强的参数一起使用?

android - android中Linearlayout里面的Linearlayout

android-studio - 尝试运行 Android 应用程序时出现 INSTALL_FAILED_MISSING_SHARED_LIBRARY 错误

java - 语法错误,插入 "... VariableDeclaratorId"以完成 FormalParameterList

android - 中断 MediaPlayer

android - 如何使用文本+图像动态填充 Android 微调器

java - 缩放 View - 不是从可绘制 View

maven - 使用谷歌云存储托管maven仓库