我想設置一個導航抽屜Neokree https://github.com/neokree/MaterialNavigationDrawer對Android Studio沒有成功。Neokree導航抽屜:未找到Gradle DSL方法:'compile()'
加入這個我gradle這個後 - >的build.gradle文件
repositories {
mavenCentral()
}
dependencies {
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
}
然後我得到這個錯誤說 「搖籃工程同步失敗」,這下面
錯誤:(27,0)未找到Gradle DSL方法:'compile()'
可能的原因:項目「MaterialNavigationDrawer」可能使用的Gradle版本不包含該方法。
Gradle設置構建文件可能缺少Gradle插件。
應用Gradle插件。
這是我的文件夾的gradle - >的build.gradle
// 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:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
}
我知道我做錯了什麼是肯定的,我似乎無法弄清楚。
而不是使用第三方庫的導航抽屜,你可以使用androids自己的設計庫中提供的導航抽屜作爲參考檢查此鏈接http://android-developers.blogspot.in/2015/05/android-design- support-library.html –
感謝您的建議,androids自己的導航抽屜其實更好。 –