2016-07-28 98 views
1

我正在尝试将Apache Tika放入我的项目中。 但它返回错误,不幸的是,我自己无法解决这个问题。如何使用android studio将TIKA添加到build.gradle中?

我怎样才能把Apache Tika使用android studio?

Error:(27, 0) Gradle DSL method not found: 'runtime()' Possible causes:

  • The project 'AudioTest' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • apply plugin: 'com.android.application' 
    
    android { 
        compileSdkVersion 23 
        buildToolsVersion "23.0.2" 
    
        defaultConfig { 
         applicationId "com.example.test.audiotest" 
         minSdkVersion 16 
         targetSdkVersion 23 
         versionCode 1 
         versionName "1.0" 
        } 
        buildTypes { 
         release { 
          minifyEnabled false 
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
         } 
        } 
    } 
    
    dependencies { 
        compile fileTree(dir: 'libs', include: ['*.jar']) 
        testCompile 'junit:junit:4.12' 
        compile 'com.android.support:appcompat-v7:23.1.0' 
        compile 'com.google.android.gms:play-services-appindexing:8.1.0' 
        runtime 'org.apache.tika:tika-parsers:1.13' 
    } 
    

    这是我的build.gradle模块:应用

    // Top-level build file where you can add configuration options common to all sub-projects/modules. 
    
    buildscript { 
        repositories { 
         jcenter() 
        } 
        dependencies { 
         classpath 'com.android.tools.build:gradle:2.1.2' 
    
         // NOTE: Do not place your application dependencies here; they belong 
         // in the individual module build.gradle files 
        } 
    } 
    
    allprojects { 
        repositories { 
         jcenter() 
        } 
    } 
    
    task clean(type: Delete) { 
        delete rootProject.buildDir 
    } 
    

    这是我的build.gradle项目:AudioTest

    +1

    显示您的build.gradle文件 –

    回答

    2

    变化

    runtime 'org.apache.tika:tika-parsers:1.13' 
    

    compile 'org.apache.tika:tika-parsers:1.13' 
    
    相关问题