Android Studio 3.0 更新后的各种坑

本文介绍了一套针对Android项目的配置优化方案,包括Gradle插件应用、依赖管理、编译选项调整、输出文件命名规范等内容,旨在提升开发效率及产品质量。

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



1.
//apply plugin: 'com.neenbedankt.android-apt' 删除

2.
apt 'com.jakewharton:butterknife-compiler:8.2.1'
更换为
annotationProcessor 'com.jakewharton:butterknife-compiler:8.2.1'

3.
EventBus
compile 'org.greenrobot:eventbus:3.0.0'
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.0.1'
4.
//apt {
// arguments {
// eventBusIndex "com.kp5000.Main.MyEventBusIndex"
// }
//}
更换为:
defaultConfig
jackOptions {
enabled true
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [ eventBusIndex : 'org.greenrobot.eventbusperf.MyEventBusIndex' ]
}
}
}
5.
applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "Kaopu5000_v${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}

更换为
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "Kaopu5000_v${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
}
}
6.
//增加选项
defaultConfig {
flavorDimensions "versionCode"
}
7.
//增加选项 gradle.properties 文件
android.enableAapt2=false
8.
App 和module中的 release debug 必须一致 没有{} 内可以为空
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
9.
@android:windowEnterAnimation
@android:windowExitAnimation
@去掉
<style name="mypopwindow_anim_style">
    <item name="android:windowEnterAnimation">@anim/alpha_and_scale_begin</item>        <!—指定显示的动画xml  -->
    <item name="android:windowExitAnimation">@anim/alpha_and_scale_end</item>       <!—指定消失的动画xml  -->
</style>







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值