android 混合开发接入flutter

2022-01-04  本文已影响0人  小康

flutter.gradle可在 flutter sdk中 /Users/wangyongbin/Documents/flutter/packages/flutter_tools/gradle 下的 flutter.gradle文件配置

project.android.buildTypes {
    // Add profile build type.
    profile {
        initWith debug
        if (it.hasProperty("matchingFallbacks")) {
            matchingFallbacks = ["debug", "release"]
        }
    }
    // TODO(garyq): Shrinking is only false for multi apk split aot builds, where shrinking is not allowed yet.
    // This limitation has been removed experimentally in gradle plugin version 4.2, so we can remove
    // this check when we upgrade to 4.2+ gradle. Currently, deferred components apps may see
    // increased app size due to this.
    if (shouldShrinkResources(project)) {
        release {
            // Enables code shrinking, obfuscation, and optimization for only
            // your project's release build type.
            minifyEnabled true
            // Enables resource shrinking, which is performed by the
            // Android Gradle plugin.
            // NOTE: The resource shrinker can't be used for libraries.
            shrinkResources isBuiltAsApp(project)
            // Fallback to `android/app/proguard-rules.pro`.
            // This way, custom Proguard rules can be configured as needed.
            proguardFiles project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro"
        }
    }
    //====================自定义构建多模块,多衍生版==============================
    debug131 {
        initWith debug
        minifyEnabled false   //混淆
        proguardFiles project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro"
    }

    pre_1.initWith(debug131)
    pre_1 {}

    release_debug.initWith(debug131)
    release_debug {}

    release {
        minifyEnabled false
        proguardFiles project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro"
    }

    release_new.initWith(release)
    release_new {}
    //====================自定义构建多模块,多衍生版==============================
}

相关视频
Android知识

上一篇 下一篇

猜你喜欢

热点阅读