Compose - Gradle 7.0+ 升级 8.0+ 问题处理

文章讲述了在Android开发中遇到的编译错误,包括defaultConfig中的自定义buildConfig字段被禁用、DSLelement的dexOptions过时以及Apmplusplugin插件与新版本Gradle不兼容的问题,提供了相应的解决方案,如修改gradle.properties和移除过时插桩配置,转向非插桩应用性能监控方法.

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

编译失败:defaultConfig contains custom BuildConfig fields, but the feature is disabled.

编译失败:DSL element 'dexOptions' is obsolete and should be removed.It will be removed in version 8.0 of the Android Gradle plugin.Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

编译失败:Apmplus plugin编译异常 Failed to apply plugin 'apm-plugin'.   API 'android.registerTransform' is removed. (适配依赖ByteX,APM暂时还没有插桩方式适配新版本Gradle方案)


编译失败:defaultConfig contains custom BuildConfig fields, but the feature is disabled.

解决方案:

gradle.properties 添加配置 

android.defaults.buildfeatures.buildconfig=true  

编译失败:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

解决方案:
如下配置移除
//    dexOptions {
//        // 对依赖的库进行dex 预处理,提升增量构建速度
//        preDexLibraries true
//        // 设置最大线程数使用,当运行dex-in-process时,默认为4
//        maxProcessCount 8
//
//        jumboMode = true
//        javaMaxHeapSize "2g"
//        additionalParameters = ['--set-max-idx-number=65000', '--num-threads=4', '--minimal-main-dex']
//    }

编译失败:Apmplus plugin编译异常 Failed to apply plugin 'apm-plugin'.
   API 'android.registerTransform' is removed. (适配依赖ByteX,APM暂时还没有插桩方式适配新版本Gradle方案)

解决方案

1.剔除插桩配置

2.替换为非插桩方式 如何根据非插桩方案接入监控能力?--应用性能监控全链路版-火山引擎

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值