前提・実現したいこと
Androidのビルドが通らなくて困っております。
位置情報の取得をするのにLocationManagerを使用しておりましたが
FusedLocationProviderClientのAPIに変更しようとしております。
発生している問題・エラーメッセージ
上記の内容で変更しようとbuild.gradleに
com.google.android.gms:play-services-location:15.0.1
上記を追加しました。
ビルドが通らず以下のようなエラーが出力されます。
Failed to resolve: com.google.android.gms:play-services-location:15.0.1
Install Repository and sync project
Show in File
Show in Project Structure dialog
上記に従いInstallを行いましたが
インストールが中断されエラーが出力されます。
Could not find dependency "com.google.android.gms:play-services-location:15.0.1"
試した解決策
解決策を探していますが以下のようなことはすべて試しました。
・build.gradleにgoogle()を入れる
・google Play Serviceを入れる
・Support Repositoryを入れる
AndroidStudioのバージョンは3.1.4を使用しております。
原因等が分かる方がいらっしゃいましたらご回答いただければ幸いです。
###ソース
以下にbuild.gradleのコードを乗せておきます。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
implementation 'com.google.android.gms:play-services-location:15.0.1'
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
useLibrary 'org.apache.http.legacy'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc... androidTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } defaultConfig { minSdkVersion 24 } productFlavors { }
}
回答1件
あなたの回答
tips
プレビュー