简体   繁体   中英

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

I'm trying to put Apache Tika into my project. But it returns error, unfortunately, I couldn't solve this problem by myself.

How can I put Apache Tika using 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'
    }
    

    this is my build.gradle module: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

    change

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

    to

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

    The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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