2015-06-18 63 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!以上链接的内容非常好!也谢谢你! –

相关问题