0

Android Studio 0.8.9를 사용하여 Android 앱을 개발 중입니다. 내 프로젝트를 빌드 할 때 Gradle을 사용하고 있습니다.Android Studio와 호환 불가 (Google Play 서비스 문제)

푸시 알림 API를 사용하려면 google-play-services.jar 파일을 프로젝트에 포함하고 싶습니다. 다음과 같이

나는 나의 Gradle을로 (응용 계층) 파일을 그 문을 추가 한 :

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile files('libs/google-play-services.jar') 
    compile files('libs/android-support-v4.jar') 
    compile files('libs/gson-2.2.3.jar') 
    compile files('libs/volley_23042014.jar') 
    compile 'com.google.android.gms:play-services:5.2.08' 
} 

을하지만, 그것은 작동하지 않습니다. 다음과 같은 오류가 발생합니다.

Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode; 

나는 (Stackoverflow.com을 포함하여) 많은 웹 사이트를 확인했습니다. 그들 중 누구도 나를 위해 일하지 못했습니다.

Google Support Library, Google Support Repository, Google Play Services의 최신 버전이 있습니다. 여기

내 libs와 디렉토리입니다

lbs directory

같은 내 SDK 버전 : 내가 잘못했을 무엇

<uses-sdk 
    android:minSdkVersion="14" 
    android:targetSdkVersion="20" /> 

? 누구든지 아이디어가 있다면 알려주세요.

답변

5

당신을 통해 플레이 서비스를 포함하는 경우 :

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

이 필요하지 않습니다 :

compile files('libs/google-play-services.jar') 

그래서 그냥 제거합니다. 의존성의 첫 번째 줄부터

은 자동으로 당신이 당신의 libs와 디렉토리에 넣어 모든 jar 파일을 선택하게됩니다 :

compile fileTree(dir: 'libs', include: ['*.jar']) 

당신이뿐만 아니라에서 항아리를 제거해야합니다. 그런 점에서 특정 병을 통해 포함하면 안되는 다른 라이브러리가 있습니다. 대신이의

:

compile files('libs/android-support-v4.jar') 
compile files('libs/gson-2.2.3.jar') 

사용이 :

compile 'com.android.support:support-v4:20.0.0' 
compile 'com.google.code.gson:gson:2.2.3 

(GSON의 이후 버전을 참고 사용할 수 있습니다).

+0

작동하지 않습니다. 나는 또한 전에 그것을 시도했다. 같은 오류가 발생합니다. – JustWork

+0

여전히 작동하지 않습니다. 그러나 '여러 개의 dex 파일이 Landroid/support/v4/AccessibilityService/AccessibilityServiceInfoCompat $ AccessibilityServiceInfoVersionImpl을 정의 함'으로 오류가 변경되었습니다. – JustWork

+0

libs 폴더에있는 v4 지원 라이브러리를 참조하십시오. 내가 말한 것처럼 그것을 제거하십시오. –

관련 문제