【Android Studio】Flamingo版本 更新gradle插件(AGP) 7.+到8.+

Flamingo版本启动图

  • 看起来是一只火烈鸟在河边练少林寺的单脚站立功夫
    【Android Studio】Flamingo版本 更新gradle插件(AGP) 7.+到8.+_第1张图片

步骤

  • build.gradle(module)
android {
    namespace ''//add
    defaultConfig {
        applicationId ''
    }
 }
  • AndroidManifest.xml 取消package属性

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:label="@string/app_name">application>
manifest>
  • gradle.properties
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.defaults.buildfeatures.buildconfig=true
android.enableBuildConfigAsBytecode=true
android.defaults.buildfeatures.aidl=true
android.defaults.buildfeatures.renderScript=true
android.enableR8.fullMode=false

buildconfig默认关闭,需要开启
aidl默认关闭,需要开启
R8由默认兼容Proguard模式改为了默认全模式,需要禁用全模式,回归兼容模式

真是没事瞎更新,说是为了优化,难道就不考虑兼容性了?每次一更,各种兼容性问题,也没见优化多少,再说了,这些可有可无的优化选项,我们想开就开,没必要你们"以为我们好的名义,人性化的"帮我们开启

  • build.gradle
plugins {
    id 'com.android.application' version '8.0.2' apply false
    id 'com.android.library' version '8.0.2' apply false
}
  • gradle/wrapper/gradle-wrapper.properties
#Sun May 28 15:37:54 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

  • Sync Project with Gradle Files
    在这里插入图片描述

参考

  • 5 ways to prepare your app build for Android Studio Flamingo release
  • Android 代码混淆 R8与Proguard
  • R8 FAQ

你可能感兴趣的:(Android,Studio,android,studio,android,gradle)