[Android] already added: Lcom/google/ads/AdRequest 오류 해결방법




증상

Android 프로젝트 빌드 시 아래와 같은 오류가 발생하며 정상적으로 빌드가 되지 않았다.



Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$Gender;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdSize;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/mediation/AbstractAdViewAdapter;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/mediation/AbstractAdViewAdapter$zza;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/mediation/AbstractAdViewAdapter$zzb;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/mediation/AbstractAdViewAdapter$zzc;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/ads/mediation/AbstractAdViewAdapter$zzd;
Unable to execute DX
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:130)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
... 13 more










원인


기존에 제작하던 App 에서 google-play-services 모듈을 의존성 걸고 사용하고 있었는데 카카오연동을 하면서 카카오모듈에 있는 google-play-services 와 충돌이 난 것으로 보인다.





구조를 보자면 아래와 같다.

My App Dependency
  ㄴ google-play-services_lib
  ㄴ kakao-android-sdk-project







해결방법

kakao 모듈의 lib에 있는 google-play-services.jar 가 들어있는 libs디렉토리 BuildPath 를 빼고 다음의 구조와 같이 변경해 줬다.

My App Dependency
  ㄴ google-play-services_lib
  ㄴ kakao-android-sdk-project
      ㄴ google-play-services_lib





IntelliJ 기준





참고
http://stackoverflow.com/questions/19814956/android-admob-exception-after-refresh-sdk



댓글