-1
我试图在我的android应用中使用facebook SDK,并且我开始将maven中央存储库添加到我的build.gardle
。虽然,我发现2 build.gardle
属于项目和应用程序。他们来了;未找到Android Studio Gradle DSL方法:'mavencentral()'
- Android的工作室:1.5.1
- 摇篮版本:2.8
- 的Android插件版本:1.5.0
Build.gardle(项目)
buildscript {
repositories {
jcenter()
mavencentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
}
allprojects {
repositories {
jcenter()
mavencentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gardle(APP)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
}
但我得到的构建在这下面的错误;
未找到摇篮DSL方法:
我试图mavencentral();
- Checking both gardle files
- Removing android compile dependencies that's actually should be there
- Checking android
packagingOptions.exclude
- Checking if there's android method in the gardle
而且,我还没有试过update my gardle or android studio,但我只是想知道它是否真的需要还是我做错了什么与我的build.gardle
。
任何建议表示赞赏。谢谢。
妈的。我怎么能错过资本'C' ..但现在我有另一同样的问题,说'Gradle DSL方法找不到:compile()'。谢谢btw .. – choz
,因为你编译facebook sdk到错误的gradle文件;) – xiaomi
正确..将它移到应用程序级别,工作得很好.. tq先生.. – choz