2015-06-18 62 views
0

我想設置一個導航抽屜Neokree https://github.com/neokree/MaterialNavigationDrawerAndroid 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' 
} 

我知道我做錯了什麼是肯定的,我似乎無法弄清楚。

+0

而不是使用第三方庫的導航抽屜,你可以使用androids自己的設計庫中提供的導航抽屜作爲參考檢查此鏈接http://android-developers.blogspot.in/2015/05/android-design- support-library.html –

+0

感謝您的建議,androids自己的導航抽屜其實更好。 –

回答

1

有一個偉大的圖書館叫MaterialDrawer。您可以在不到5分鐘的時間內將該庫集成到您的項目中(請閱讀其README.md和Wiki-許多信息都可以在這裏找到!)。

祝你好運!

+1

+1,謝謝你的回答,但是我發現Androids自己的導航抽屜教程在這裏https://github.com/codepath/android_guides/wiki/Fragment-Navigation-Drawer這是一個很好的幫助。 –

+0

不客氣@HtmlTosin!以上鍊接的內容非常好!也謝謝你! –

相關問題