Не удается разрешить импорт com.google.android.gms - PullRequest
0 голосов
/ 06 сентября 2018

Я сделал игру с использованием библиотеки Libgdx. Теперь я хочу добавить таблицу лидеров в свою игру. Для этого я следовал этому уроку: здесь

Но в этом уроке я остановился на шаге 29. Потому что мой импорт не разрешен.

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.Games.GamesOptions;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
import com.google.android.gms.games.request.GameRequest;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.Plus.PlusOptions;

Например, после того, как я напишу import com.google.android.gms.games и напишу ., мне покажутся только две подсказки: R и *.

В sdk manager сервисы Google Play уже установлены. (Я использую Android Studio)

Также, это мои проекты build.gradle для Android:

   project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile "com.google.android.gms:play-services-games:15.0.1"// I think this line should solve all imports problem, but it can't
        compile "com.google.android.gms:play-services-auth:16.0.0"
        compile "com.google.android.gms:play-services-auth:11.6.0"
        compile 'com.google.android.gms:play-services:+'

        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:$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-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"

    }
}

Что я могу сделать для решения этой проблемы?

Ответы [ 2 ]

0 голосов
/ 08 июня 2019
  1. Откройте файл build.gradle в каталоге модуля приложения.
  2. Добавить новое правило сборки в зависимости для последней версии играть-услуги.
  3. Убедитесь, что ваш build.gradle верхнего уровня содержит ссылку на репозиторий google () или maven {url "https://maven.google.com"}.
  4. Сохраните изменения и нажмите Синхронизировать проект с файлами Gradle в панель инструментов.

enter image description here

0 голосов
/ 06 сентября 2018

вам не хватает библиотеки play-services-base:

compile "com.google.android.gms:play-services-base:15.0.1"
compile "com.google.android.gms:play-services-auth:16.0.0"
compile "com.google.android.gms:play-services-games:15.0.1"

... а также, добавив play-services-auth дважды, по любой причине. а также play-services:+ представляется неправильным и поэтому также должно быть удалено. с новой версией необходимо добавить эти зависимости индивидуально.

...