Gradle DSL cannot find sources()

冷暖自知 提交于 2020-01-06 08:18:11

问题


I'm quite new to AR and I'm using Android Studio 2.1.2 and I tried to run the examples provided by ARToolKit.

the error says: Gradle DSL method not found: 'sources()'

I'm using Gradle 2.13, below is the code

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig.with {
        applicationId "org.artoolkit.ar.samples.ARSimple"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        //Integer type incremented by 1 for every release, major or minor, to Google store
        versionName "1.0" //Real fully qualified major and minor release description

        //buildConfigFields.with {
        //Defines fields in the generated Java BuildConfig class, in this case, for
        // create() {           //default config, that can be accessed by Java code
        //    type "int"     //e.g. "if (1 == BuildConfig.VALUE) { /*do something*/}".
        //    name "VALUE"
        //See: [app or lib]/build/generated/source/buildConfig/[package path]/
        //    value "1"      //     BuildConfig.java
        // }
        //  }
    }

}

android.buildTypes {
    release {
        minifyEnabled false
        proguardFiles file('proguard-rules.pro')
    }
}

android.productFlavors {
}



android.sources {
    main.jni {
        source {
            srcDirs "src/main/nop"
        }
    }
    main.jniLibs {
        source {
            srcDirs "src/main/libs"
        }
    }
}

dependencies {
    //compile 'com.android.support:support-v4:23.0.1'
    //compile 'com.android.support:appcompat-v7:23.0.1' //Only required when the target device API level is greater than
    compile project(':aRBaseLib')
}                                                       //the compile and target of the app being deployed to the device

android {
    buildToolsVersion '23.0.3'
}

回答1:


have you followed these instructions on how to set-up your environment with ARToolKit and native development?

http://artoolkit.org/documentation/doku.php?id=4_Android:android_native

Please follow these instructions as they guide you to setup your system even if you do not aim to develop native.

Other than that I cannot do much as your description contains to less information.

The ARToolKit examples ship with a preconfigured gradle.wrapper that contains the correct version and the examples generally build out of the box.

gradle.wrapper

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip

build.gradle (From ARSimpleProj)

buildscript {
  repositories {
    jcenter()
  }

dependencies {
    classpath 'com.android.tools.build:gradle-experimental:0.2.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    jcenter()
  }
}


来源:https://stackoverflow.com/questions/38702437/gradle-dsl-cannot-find-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!