2016-11-05 36 views
2

我遵循了許多解決方案,只是爲了讓它運行起來並在這裏結束,但不知道還有什麼可做的。無法找到適用於參數的方法apply()

如何配置此項目運行?

的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他們:\用戶\ lwy.gradle \包裝\ dists中:

enter image description here

+0

我正在運行我的項目,但錯誤如下所示:錯誤:(1,0)找不到方法apply()參數[{plugin = com.android.application}]項目':app'的類型org .gradle.api.Project。 Open File Ivy

+0

從build.gradle中刪除* apply plugin:'groovy'*並嘗試 – Nisarg

+0

我評論了apply plugin:'groovy'和Sync Project with Gradle Files的代碼,但錯誤仍然存​​在。 – Ivy

回答

2

我已經解決了這個問題!這裏是我的可能:

1.複製「build.gradle」的節點,然後刪除「build.gradle」;

2.創建一個新的build.gradle和以前的內容粘貼到這個「的build.gradle」

這一切!

相關問題