iT邦幫忙

0

android studio build.gradle dependencies 依賴項

wcas 2018-10-21 11:58:432360 瀏覽

我想要用Android Beacon Library來讀取beacon
我參考Android Beacon Library網站
用來implements BeaconConsumer
在build.gradle裡面我是這樣寫

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        implementation 'org.altbeacon:android-beacon-library:2+'//這一行
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }

}

但是這樣會出現錯誤
Could not find method implementation() for arguments [org.altbeacon:android-beacon-library:2+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
我試了很多方法也換用其他的依賴方法
也到MVNrepository裡面找過了
請問有人可以告訴我該怎麼解決嗎?
謝謝

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
藍諾
iT邦新手 5 級 ‧ 2018-10-21 12:47:38
最佳解答

不太熟,會是放錯 build.gradle ? 試試另一個 build.gradle(Module: app)

    // NOTE: Do not place your application dependencies here; they belong
  // in the individual module build.gradle files

以下是我測試結果,可以正常使用
https://ithelp.ithome.com.tw/upload/images/20181021/20111944GXByPn1bgB.png

wcas iT邦新手 5 級 ‧ 2018-10-21 13:14:50 檢舉

原來是我放錯位置了
他說要先確認jcenter()所以我以為是另一個
我一直在另一個build.gradle做白工

我要發表回答

立即登入回答