해결 실패 : Gradle을 사용하는 IntelliJ Idea의 com.google.android.gms : play-services
IntelliJ Idea의 libGDX 프로젝트에 Google Play 서비스를 추가하려고합니다. 여기에서 설정 가이드를 따랐습니다 : https://developers.google.com/android/guides/setup
꽤 간단 해 보입니다. 해당 섹션의 build.gradle에 해당 행을 추가 했으므로 이제 다음과 같이 보입니다.
project(":android") {
apply plugin: "android"
apply plugin: 'com.android.application'
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile 'com.google.android.gms:play-services:11.2.0'
}
}
그런 다음 "Failed to resolve"오류를 얻기 위해 Idea에서 내 gradle 프로젝트를 동기화하려고합니다.
설정 가이드에는 "Google Play 서비스가 업데이트 될 때마다이 버전 번호를 업데이트해야합니다."라고 표시되어 있지만 문제는 해당 버전 번호를 찾는 것이 거의 불가능 해 보입니다. Android SDK에 따른 Google Play 서비스 SDK 버전 관리자는 "43"이고 지금까지 이러한 "11.2.0"또는 일반적인 버전 문자열을 "43"버전 번호와 연관시킬 수 없었습니다. 설정 가이드가 그것에 대해 아무것도 말하지 않습니다.
어쨌든 나는 이것과 관련된 과다한 질문에서 많은 것을 시도했지만 아무 소용이 없습니다. 특히, 내 Android SDK가 제대로 업데이트되어 있고 이것이 Idea에서 사용하고 있다고 확신합니다 (이미 세 번 확인했습니다 ...).
API 레벨 26을 사용하고 있지만 어쨌든 다른 정의는 Android SDK에 대해 동일한 디렉토리를 사용합니다. 또한이 노트북에는 다른 Android SDK가 전혀 설치되어 있지 않으므로 Idea가 해당 SDK 만 사용하는 것에 대해서는 의심 할 여지가 없습니다.
어떤 아이디어라도 환영합니다.
미리 감사드립니다!
jcenter()
이전 google()
에 프로젝트 수준 build.gradle에 넣을 때 문제가 발생 했습니다. 주문을 변경하고 build.gradle google()
전에 넣으면 jcenter()
문제가 사라졌습니다.
다음은 내 최종 빌드입니다.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
방금 버전 11.2.0을 11.0.0으로 교체 한 다음 제대로 작동하는 것 같았으므로 11.2.0이 최신 Android SDK에 포함되지 않았 음을 의미해야합니다.
따라서 사용 가능한 모든 흩어져있는 문서로 고생 한 후 우연히이 문서에 도달했습니다 (Google에서 충분히 높은 색인을 생성하지 않은 것 같습니다) : https://developers.google.com/android/guides/releases
나는 거기에서 인용한다.
Google Play 서비스 11.2 릴리스의 하이라이트. 이제 maven.google.com을 통해 Google Play 서비스 종속성을 사용할 수 있습니다.
이제 다운로드 한 SDK에서 더 이상 사용할 수 없다는 의미는 아니지만 실제로는 그런 것 같습니다.
어쨌든 내 build.gradle에 google ()을 추가하는 것이 작동하지 않았으므로 (찾을 수 없거나 정의되지 않았거나 무엇이든 ...) 이전 문서에서 참조 한 다른 접근 방식을 사용했습니다.
https://developer.android.com/studio/build/dependencies.html#google-maven
다음과 같이 모든 프로젝트 / 리포지토리에 해당 줄을 추가하는 build.gradle 파일을 수정했습니다.
allprojects {
...
repositories {
...
maven { url "https://maven.google.com/"}
}
}
그런 다음 동일한 build.gradle 파일의 android 섹션에서도 :
project(":android") {
...
dependencies {
...
compile 'com.google.android.gms:play-services-ads:11.2.0'
}
}
이 두 줄은 Gradle을 문제없이 동기화하는 데 충분했습니다. 기본적으로 libGDX 프로젝트에 이미 추가 된 플러그인 외에는 플러그인을 추가 할 필요가 없습니다.
그 후 몇 가지 다른 오류가 발생했지만 Gradle 또는 종속성에 대해서는 없습니다. 간단히 말해서 JFTR :
먼저 minSdkVersion이 8이었습니다. 14로 올려서 해결했습니다. 14 이하의 모든 장치를 지원하지 않고도 살 수 있다고 생각합니다.
둘째, 참조의 dex 상한에 문제가있었습니다. 나는이 문제에 직면 한 적이 없지만 내가 사용한 해결책을 이미 눈치 채 셨을 것입니다. 전체 'com.google.android.gms : play-services'를 컴파일하는 대신 'com.google.android.gms'만 사용했습니다. : play-services-ads '는 제가 지금 실제로 관심을 갖고있는 API입니다. 이와 같은 솔루션이 유용하지 않을 수있는 다른 특정 사례의 경우이 문서가 더 나은 통찰력을 제공 할 수 있습니다. https://developer.android.com/studio/build/multidex.html
셋째, 그 후에도이 "점보"문제에 대해 설명하고 여기에 답변했습니다. https://stackoverflow.com/a/26248495/1160360
그리고 그게 다야. 지금은 모든 것이 빌드되고 내 게임이 마침내 Admob 배너를 표시합니다.
나는 이것에 대해 몇 시간을 보냈고, 그래서 우리가 최근에 사용하고있는 이러한 모든 빌딩 자동화 시스템이 그들이 추가하는 추가 부하의 가치가 있는지 궁금합니다.
5 년 전에 처음으로 Admob을 앱에 추가해야했을 때 .jar 파일을 다운로드하여 프로젝트의 디렉토리에 저장해야했습니다. "내 안드로이드 프로젝트에서 Admob을 설정하는 방법"을 검색하는 것부터 내 앱에 Admob 배너를 표시하는 데까지 몇 분 밖에 걸리지 않았습니다. 여기는 그런 종류의 논쟁의 장소가 아니기 때문에 여기에 남겨 두겠습니다.
그럼에도 불구하고 내 경험이 다른 사람에게 더 유용하기를 바랍니다.
프로젝트 레벨 build.gradle
파일에 다음 을 추가 하십시오.
repositories {
maven {
url "https://maven.google.com"
}
}
그것은 나를 위해 일했습니다
Android Studio를 한동안 사용하지 않았고 업데이트를 알지 못한 후 몇 시간 동안이 문제를 해결하려고 시도했습니다.
It is important that google()
is the first item that stands in repositories
like this:
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
Somehow google()
was the second item after jcenter()
, so everything was messed up and didn't work. Maybe this helps someone.
Google Play services SDK is inside Google Repository
.
Start Intellij IDEA.
On the Tools menu, click Android > SDK Manager.
Update the Android SDK Manager: click SDK Tools, expand Support Repository, select Google Repository, and then click OK.
Current Google Repository version is 57.
After update sync your project.
EDIT
From version 11.2.0
, we've to use the google maven repo so add google maven repo link in repositories tag. Check release note from here.
allprojects {
..
repositories {
...
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
}
A more up to date answer:
allprojects {
repositories {
google() // add this
}
}
And don't forget to update gradle to 4.1+ (in gradle-wrapper.properties):
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
source: https://developer.android.com/studio/build/dependencies.html#google-maven
I have found following solution to replace following code
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It's work fine for me
At the latest Google Play Services 15.0.0
, it occurs this error when you include entire play service like this
implementation 'com.google.android.gms:play‐services:15.0.0'
Instead, you must specific the detail service like Google Drive
com.google.android.gms:play-services-drive:15.0.0
Check you gradle settings, it may be set to Offline Work
I hade the same problem and it resolved by disabling cradle offline mode although I could not remember when I did disable it!
heres the solution:
How to disable gradle 'offline mode' in android studio?
I had that problem. And I found this solve. In Android Studio, Open File menu, and go to Project Structure, In Module app, go to dependencies tab and you can add 'com.google.android.gms:play-services:x.x.x' by clicking on + button.
this is probably about you don't entered correct dependency version. you can select correct dependency from this:
file>menu>project structure>app>dependencies>+>Library Dependency>select any thing you need > OK
if cannot find your needs you should update your sdk from below way:
tools>android>sdk manager>sdk update>select any thing you need>ok
I got this error too but for a different reason. It turns out I had made a typo when I tried to specify the version number as a variable:
dependencies {
// ...
implementation "com.google.android.gms:play-services-location:{$playServices}"
// ...
}
I had defined the variable playServices in gradle.properties in my project's root directory:
playServices=15.0.1
The typo was {$playServices}
which should have said ${playServices}
like this:
dependencies {
// ...
implementation "com.google.android.gms:play-services-location:${playServices}"
// ...
}
That fixed the problem for me.
'developer tip' 카테고리의 다른 글
Android Studio 설치 중 유효한 JVM 설치 오류를 가리 키지 않음 (0) | 2020.11.09 |
---|---|
두 CG 포인트 사이의 거리를 찾는 방법은 무엇입니까? (0) | 2020.11.09 |
UIView의 배경 이미지를 채우는 방법 (0) | 2020.11.09 |
Eclipse 용 PHP Mess Detector (0) | 2020.11.09 |
전처리 또는 후 처리 roxygen 스 니펫 (0) | 2020.11.09 |