无法为参数找到方法apply()

时间:2016-11-05 03:18:06

标签: android

我已经遵循了许多解决方案,只是为了让它运行并在这里结束,但不知道还能做什么。

如何配置此项目以运行?

的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {

    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    //兼容Android6.0系统所需,如果这句话报错,可在dependencies标签下使用compile 'cn.bmob.android:http-legacy:1.0'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.htq.baidu.com.htq.baidu.coolnote"

        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    buildTypes {

        release {
            //minifyEnabled false
            // signingConfig signingConfigs.release
            // minifyEnabled true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }

    sourceSets {

        main() {

            jniLibs.srcDirs = ['libs']
        }
    }
    lintOptions {

        ignoreWarnings true
        //lint 遇到 error 时继续 构建

        abortOnError false
        //build release 版本 时 开启lint 检测

        checkReleaseBuilds false
        // 防止在发布的时候出现因MissingTranslation导致Build Failed!

        disable 'MissingTranslation'

    }
}

dependencies {

   compile fileTree(dir: 'libs', include: ['*.jar'])

    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:23.4.0'

    compile 'com.android.support:design:23.4.0'

    compile 'com.jakewharton:butterknife:8.2.1'

    apt 'com.jakewharton:butterknife-compiler:8.2.1'

    compile 'com.google.android.gms:play-services-appindexing:8.1.0'

    compile 'cn.bmob.android:http-legacy:1.0'

    compile 'cn.bmob.android:bmob-sdk:3.4.7-aar'

    compile 'org.greenrobot:eventbus:3.0.0'

    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'

    compile 'com.github.clans:fab:1.6.1'

}
apply plugin: 'groovy'
apply plugin: 'groovy'

setting.gradle

include ':app'

local.properties:

sdk.dir=D\:\\Android\\sdk

gradle.propertes:

#Project-wide Gradle settings.


# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

# http://www.gradle.org/docs/current/userguide/multi_project_builds.html
#sec:decoupled_projects
# org.gradle.parallel=true

gradle-wrapper.properties

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

我在C:\ Users \ lwy.gradle \ wrapper \ dists中安装了它们:

enter image description here

3 个答案:

答案 0 :(得分:2)

我已经解决了这个问题!这是我的可能:

1.复制“build.gradle”的内容,然后删除“build.gradle”;

2.创建一个新的build.gradle并将之前的内容粘贴到此“build.gradle”

这就是全部!

答案 1 :(得分:0)

当您将文件保存为 unicode 格式时会发生这种情况。所以复制其他文件中的内容并删除旧的。

答案 2 :(得分:0)

对于我来说,把文件编码从UTF-8 BOM改成UTF-8,解决了我的问题。