在Android Studio中构建Comriva

时间:2016-02-17 03:38:35

标签: android android-studio gradle mfcc

我正在使用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')
}

请帮我解决这个问题。

2 个答案:

答案 0 :(得分:2)

您尚未明确包含的库有时会被传递到您的构建中 - 例如,您添加的库依赖于另一个库。

您可以运行gradle dependencies来显示依赖关系树,以分析哪些依赖关系拉入哪些传递依赖关系。

答案 1 :(得分:1)

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