Error when building apk - “Multiple dex files define Lcom/google/ads/Ad”

前端 未结 6 1482
情歌与酒
情歌与酒 2020-12-02 00:57

I\'ve been tearing my hair out over this one, for the past 3 hours I\'ve been trying to fix it but have been unable to. I\'ve created an android app and I\'m ready to put it

6条回答
  •  温柔的废话
    2020-12-02 01:05

    As other have noted, this problem should be due to multiple versions of Goodle's ad SDK classes being included in the app build. What I haven't seen yet is a note that the most recent Google Play Service lib includes classes that (at least) share the same names as some in the admob sdk-- for example, I came upon this error because I was trying to build with both admob sdk v.4.0.4 and the google-play-services_lib project as a referenced project; the latter contains google-play-services.jar which contains the package com.google.ads and many of the same classes as the admob sdk. Thus it appears that the google play services lib and the admob sdk cannot both be used in a given app. My solution was to remove the admob sdk entirely from the build.

提交回复
热议问题