program story

com.google.android.gms 가져 오기를 확인할 수 없습니다.

inputbox 2020. 10. 24. 10:13
반응형

com.google.android.gms 가져 오기를 확인할 수 없습니다.


저는 Android 개발이 처음입니다. 다음으로 이 튜토리얼을 나는 오류를 가지고 The import com.google.android.gms cannot be resolved나는에 코드를 쓸 때 MainActivity.java:

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

다양한 수정 사항을 검색하여 다음을 시도해 보았습니다.

  • Android SDK 관리자를 통해 특정 API 수준에 대한 Google API를 다운로드했습니다.
  • 프로젝트 빌드 대상으로 Google API를 확인했습니다.
  • 태그 의 자식 <uses-library android:name="com.google.android.maps" />으로 줄을 추가했습니다 .AndroidManifest.xml<application>
  • Project->Clean...처음부터 선택 하고 빌드 하여 프로젝트를 정리 했습니다.
  • .jar내 프로젝트를 마우스 오른쪽 버튼으로 클릭하여지도 용 파일을 포함 하고 빌드 경로로 이동하여 SDK에서 파일을 찾는 외부 아카이브를 추가했습니다.android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps

불행히도 위의 어느 것도 도움이되지 않았습니다.


프로젝트 빌드 대상으로 Google API를 확인했습니다.

이는 Maps V1의 경우와 관련이 없으며 Maps V2를 사용하려고합니다.

내 프로젝트를 마우스 오른쪽 버튼으로 클릭하여지도 용 .jar 파일을 포함하고 빌드 경로로 이동하여 내 SDK에있는 외부 아카이브를 추가했습니다. android-sdk-windows \ add-ons \ addon_google_apis_google_inc_8 \ libs \ maps

이것은 두 배로 잘못되었습니다.

첫째, Android 프로젝트에서 빌드 경로를 수동으로 수정하지 마십시오. . 그렇게하는 경우, 프로젝트에 넣었다고 생각하는 JAR (수동 빌드 경로 변경을 통해)이 APK에 없기 때문에 기껏해야 런타임에 충돌이 발생합니다. 일반 타사 JAR의 경우에 넣어 libs/자동으로 빌드 경로에 추가합니다 프로젝트의 디렉토리, 그리고 당신의 APK 파일에 내용을 추가합니다.

그러나 Maps V2는 JAR이 아닙니다. JAR이 포함 된 Android 라이브러리 프로젝트입니다. 전체 도서관 프로젝트가 필요합니다.

android-sdk-windows\add-ons\addon_google_apis_google_inc_8프로젝트를 Eclipse 로 가져온 다음 Android 라이브러리 프로젝트에 대한 참조로 앱에 추가해야합니다 .


또 다른 방법은 Eclipse가 가져 오기 작업을 수행하도록하는 것입니다. com.google.android.gms해결할 수없는 가져 오기 위로 마우스를 가져간 후 팝업 메뉴 하단으로 이동하여 아래와 같이 프로젝트 설정 수정 ... 옵션을 선택합니다. 그런 다음 Google Play 서비스 라이브러리를 가져 오라는 메시지가 표시됩니다. 그것을 선택하면 잘 될 것입니다.

여기에 이미지 설명 입력


내 경험에서 (Eclipse) :

  1. google-play-services_lib를 프로젝트로 추가하고 내 앱에서 참조했습니다.
  2. 수동으로 추가 된 모든 병을 제거했습니다.
  3. 내 프로젝트의 "libs"폴더에 google-play-services.jar를 추가했습니다.
  4. 주문 및 내보내기 탭을 엉망으로 만들었 기 때문에 몇 가지 큰 문제가 있었기 때문에 작업 솔루션은 (이 순서대로) src, gen, Google API, Android Dependencies, Android Private Libraries (이 항목 만 내보내도록 확인 됨)입니다.

내 경우 또는 모두 Android 스튜디오를 사용하는 경우

Google Play 서비스를 가져올 수 있습니다.

당신의 build.gradle

compile 'com.google.android.gms:play-services:7.8.0'

또는 최신 버전의 플레이 서비스는이 답변을 시청하는 시간에 따라 다릅니다.

더 구체적인 수입

이 개별 gradle 가져 오기를 검토하십시오.

https://developers.google.com/android/guides/setup

구글지도

com.google.android.gms:play-services-maps:7.8.0

오류가 발생할 수 있습니다

프로젝트를 gradle 파일과 동기화하는 동안 오류가 발생하는 경우

여기에 이미지 설명 입력

최신 업데이트를 설치했는지 확인하십시오

1- Android 지원 저장소.

2- Android 지원 라이브러리.

3- Google 저장소.

4-Google Play 서비스.

여기에 이미지 설명 입력

응답하려면 Android 스튜디오를 다시 시작해야 할 수 있습니다.


Note that once you have imported the google-play-services_lib project into your IDE, you will also need to add google-play-services.jar to: Project=>Properties=>Java build path=>Libraries=>Add JARs


Above solutions should solve your problem. If these do not, make sure you update your Android sdk using SDK manager and install the latest lib project and then repeat the above steps again.


once again Make sure these 2 things happen correctly nothing more than that. (FOR ECLIPSE USERS)

1) copy the jar file from --> C:\Users(your-username)\android-sdks\extras\google\google_play_services\libproject\google-play-services_lib\libs\ google-play-services.jar

2) Right Click Project--> Build Path -> Add External Archive-> google-play-services.jar


In Android Studio goto: File -> Project Structure... -> Notifications (last entry) -> check Google Cloud Messaging

Wait a few seconds and you're done :) import com.google.android.gms.gcm.GcmListenerService should be resolved properly


I too had the same issue. Got it resolved by compiling with the latest sdk tool versions.(Play services,build tools etc). Sample build.gradle is shown below for reference.

    apply plugin: 'com.android.application'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.abc.bcd"
        minSdkVersion 14
        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'])
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:appcompat-v7:23.0.1'
}

Supposing that you are using ECLIPSE:

Right click PROJECT PROPERTIES ANDROID

If you have a version of ANDROID checked, you must change it to a GOOGLE API. Choose a version of GOOGLE APIS compatible with your project's target version.


In my case only after I added gcm.jar to lib folder, it started to work. It was here: C:\adt-bundle-windows-x86_64-20131030\sdk\extras\google\gcm\gcm-client\dist

So the google-play-services.jar didn't work...


나는 멍청한 API가 가져 오기 라인을 변경하여 다음과 같이 결정하도록 동일한 문제가 발생했습니다.

import com.google.android.gms.maps.model.LatLng;

참고 URL : https://stackoverflow.com/questions/15990075/the-import-com-google-android-gms-cannot-be-resolved

반응형