简体   繁体   English

如何使用android studio将TIKA添加到build.gradle中?

[英]How to add TIKA into build.gradle using android studio?

I'm trying to put Apache Tika into my project. 我正在尝试将Apache Tika放入我的项目中。 But it returns error, unfortunately, I couldn't solve this problem by myself. 但它遗漏了错误,遗憾的是,我自己无法解决这个问题。

How can I put Apache Tika using android studio? 如何使用Android工作室安装Apache Tika?

Error:(27, 0) Gradle DSL method not found: 'runtime()' Possible causes: 错误:(27,0)未找到Gradle DSL方法:'runtime()'可能的原因:

  • The project 'AudioTest' may be using a version of Gradle that does not contain the method. 项目'AudioTest'可能正在使用不包含该方法的Gradle版本。 Open Gradle wrapper file 打开Gradle包装文件
  • The build file may be missing a Gradle plugin. 构建文件可能缺少Gradle插件。 Apply Gradle plugin 应用Gradle插件
  • 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'
    }
    

    this is my build.gradle module:app 这是我的build.gradle模块:app

    // 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
    }
    

    this is my build.gradle project:AudioTest 这是我的build.gradle项目:AudioTest

    change 更改

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

    to

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

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM