引入google Ad(AdMob 22.1.0)相关问题解决记录(包冲突,版本冲突)_checkduplicatesrunnable-程序员宅基地

技术标签: java  android  前端  google Ads  AdMob  

引入implementation 'com.google.android.gms:play-services-ads:22.1.0’引发一系列问题解决记录。

1、包冲突:CheckDuplicatesRunnable Duplicate class

What went wrong:
Execution failed for task ':app:checkStreamingtvPRODDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.google.android.gms.internal.measurement.zzhx found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zzna found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznb found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznc found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznd found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzga found in modules jetified-play-services-measurement-19.0.1-runtime (com.google.android.gms:play-services-measurement:19.0.1) and jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2)
Duplicate class com.google.android.gms.measurement.internal.zzhe found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhf found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhg found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhh found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhi found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhj found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzio found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzit found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)

 Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

解决办法:排除重复的包的其中一个

configurations.all {
    
//        exclude group:'com.google.android.gms.measurement.internal',module:'play-services-measurement-base'//20.1.2
        exclude group:'com.google.android.gms',module:'play-services-measurement-impl'
        exclude group:'com.google.android.gms',module:'play-services-measurement'
    }

2、编译版本不匹配(minCompileSdk)

在这里插入图片描述

解决办法:强制指定使用低版本

configurations.all {
    
        resolutionStrategy {
    
            force 'androidx.browser:browser:1.3.0'//focus
            force 'androidx.work:work-runtime:2.7.0-alpha05'
//            force 'androidx.work:work-runtime:2.7.1'
//            force 'androidx.work:work-runtime-ktx:2.7.1'
        }

//        exclude group:'com.google.android.gms.measurement.internal',module:'play-services-measurement-base'//20.1.2
        exclude group:'com.google.android.gms',module:'play-services-measurement-impl'
        exclude group:'com.google.android.gms',module:'play-services-measurement'
    }

3、Target S+, PendingIntent 问题

2023-07-27 10:47:08.959 13550-13572/? E/AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1
    Process: com.vod.droid.mixtv, PID: 13550
    java.lang.IllegalArgumentException: com.vod.droid.mixtv: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:408)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:688)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:675)
        at androidx.work.impl.utils.ForceStopRunnable.b(SourceFile:4)
        at androidx.work.impl.utils.ForceStopRunnable.run(SourceFile:31)
        at a.f0.r.p.h$a.run(SourceFile:1)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
        at java.lang.Thread.run(Thread.java:1012)

解决办法:androidx.work:work-runtime 版本问题 指定此版本可接决

force 'androidx.work:work-runtime:2.7.0-alpha05'

4、找不到class Didn’t find class “com.google.android.gms.measurement.internal.zzfs”

Failed to load IDynamiteLoader from GmsCore: Application package com.google.android.gms not found
E  FATAL EXCEPTION: ScionFrontendApi
Process: com.vod.droid.mixtv, PID: 11197
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/measurement/internal/zzfs;
at com.google.android.gms.measurement.internal.AppMeasurementDynamiteService.initialize(com.google.android.gms:play-services-measurement-sdk@@19.0.1:2)
at com.google.android.gms.internal.measurement.zzcx.zza(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:12)
at com.google.android.gms.internal.measurement.zzdt.run(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.internal.zzfs" on path: DexPathList[[zip file "/data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/base.apk"],nativeLibraryDirectories=[/data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/lib/arm, /data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.measurement.internal.AppMeasurementDynamiteService.initialize(com.google.android.gms:play-services-measurement-sdk@@19.0.1:2) 
at com.google.android.gms.internal.measurement.zzcx.zza(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:12) 
at com.google.android.gms.internal.measurement.zzdt.run(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:2) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 

解决办法:
实际搜索是有此类的
在这里插入图片描述

包冲突 移除 :exclude group:‘com.google.android.gms’,module:‘play-services-measurement-sdk’

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lb687/article/details/131980583

智能推荐

整理5个优秀的微信小程序开源项目_微信小程序开源模板-程序员宅基地

文章浏览阅读1w次,点赞13次,收藏97次。整理5个优秀的微信小程序开源项目。收集了微信小程序开发过程中会使用到的资料、问题以及第三方组件库。_微信小程序开源模板

云解析DNS使用教程_aiyun的云解析dns服务是什么-程序员宅基地

文章浏览阅读2.4k次。课程介绍云解析(Domain Name System,简称DNS)是一种高可用性、高可扩展的权威DNS服务和DNS管理服务。它的目的是为企业和开发者提供稳定、安全、智能的把网站域名或应用资源转换为计算机用于互连的数字 IP地址,从而将最终用户的访问路由到相应的网站或应用资源上同时提供DNS的管理服务。产品详情:https://wanwang.aliyun.com/domain/dns/_aiyun的云解析dns服务是什么

3dmax 使用中的遇到的问题_mmd文件导入3ds max-程序员宅基地

文章浏览阅读1.1k次。2020版本,也许其它安装类型的脚本也可以用同样的方式清理删除""文件夹,注意里面是配置文件,删除前记得备份。同时清理注册表。_mmd文件导入3ds max

页面跳转并数据传递-不同页面的传递数据_cshtml 跳转页面并传整行数据-程序员宅基地

文章浏览阅读4.6k次,点赞2次,收藏19次。1、第一个登录页面,里面有提交表单,action提交到index页面2、第二个页面,可以使用第一个页面的参数,实现一个数据不同页面之间的传递效果3、第二个页面之所以可以使用第一个页面的数据,就是利用了URL里面的location.search参数4、第二个页面提取参数5、去掉?6、分隔符分开表单form:可以将内容提交到另外一个页面上输入页面:<!DOCTYPE html><html lang="en"><head> ._cshtml 跳转页面并传整行数据

许愿墙 许下你的愿望_编程实现许愿墙的页面结构,效果图如下:-程序员宅基地

文章浏览阅读829次,点赞2次,收藏17次。许愿墙 许下你的愿望_编程实现许愿墙的页面结构,效果图如下:

【100%通过率】华为OD机试真题 Python 实现【最差产品奖】【2022.11 Q4 新题】-程序员宅基地

文章浏览阅读1.9w次,点赞2次,收藏3次。A公司准备对他下面的N个产品评选最差奖,评选的方式是首先对每个产品进行评分,然后根据评分区间计算相邻几个产品中最差的产品。评选的标准是依次找到从当前产品开始前M个产品中最差的产品,请给出最差产品的评分序列。_最差产品奖

随便推点

android 退出应用没有走ondestory方法,[Android基础论]为何Activity退出之后,系统没有调用onDestroy方法?...-程序员宅基地

文章浏览阅读1.3k次。首先,问题是如何出现的?晚上复查代码,发现一个activity没有调用自己的ondestroy方法我表示非常的费解,于是我检查了下代码。发现再finish代码之后接了如下代码finish();System.exit(0);//这就是罪魁祸首为什么这样写会出现问题System.exit(0);////看一下函数的原型public static void exit (int code)//Added ..._android 手动杀死app,activity不执行ondestroy

SylixOS快问快答_select函数 导致堆栈溢出 sylixos-程序员宅基地

文章浏览阅读894次。Q: SylixOS 版权是什么形式, 是否分为<开发版税>和<运行时版税>.A: SylixOS 是开源并免费的操作系统, 支持 BSD/GPL 协议(GPL 版本暂未确定). 没有任何的运行时版税. 您可以用她来做任何 您喜欢做的项目. 也可以修改 SylixOS 的源代码, 不需要支付任何费用. 当然笔者希望您可以将使用 SylixOS 开发的项目 (不需要开源)或对 SylixOS 源码的修改及时告知笔者.需要指出: SylixOS 本身仅是笔者用来提升自己水平而开发的_select函数 导致堆栈溢出 sylixos

企业级数据分析平台/springBoot-controller全局异常管理_naga数据分析平台-程序员宅基地

文章浏览阅读135次。我们要通过实现三个类,来实现一个web后端的全局异常管理功能,捕获controller层异常,封装成map集合,进行返回1.实现异常处理的工具类实现一个imooc.naga.core.exception,异常处理的包,定义两个类分别是:1.系统返回状态标识码实体类,2:封装了异常状态值,和异常信息内容的实体类1.系统返回状态标识码实体类package imooc.naga.core.exception;/** * 定义我们系统返回值的状态标志 */public class ErrorCo_naga数据分析平台

Matlab 读取批量txt格式的气象数据_读取气象a文件-程序员宅基地

文章浏览阅读394次,点赞8次,收藏9次。fileFolder=fullfile('G:\气象数据\sitedata\day_temperature1951_2017');%将从该文件夹中提取的数据并入到上一个文件夹中的数据,;%如果该文件夹里有该站点的数据,则min_line不是空。_读取气象a文件

Java乐观锁-程序员宅基地

文章浏览阅读2.2k次,点赞5次,收藏9次。乐观锁是一种并发控制的策略,它假设多个线程在操作共享数据时,不会发生冲突,因此不需要加锁,而是在更新数据时,通过比较当前状态和上一次的状态,来判断是否有其他线程修改了数据。版本号控制的思想是,在数据表中增加一个版本号字段(或者时间戳字段),每次更新数据时,都将版本号加一(或者更新时间戳),并且在更新时,检查当前的版本号是否和数据库中的一致,如果一致,就执行更新操作;ABA问题是指,在一个线程执行CAS操作时,发现内存中的值没有变化(仍然为A),就认为没有其他线程修改过这个值,然后执行更新操作。_乐观锁

推荐文章

热门文章

相关标签