关于android:android-混合开发接入flutter

38次阅读

共计 1663 个字符,预计需要花费 5 分钟才能阅读完成。

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 混合开发接入 flutter

正文完
 0