Coder Social home page Coder Social logo

Comments (5)

lijy91 avatar lijy91 commented on August 22, 2024

可以提供一下你的 build.gradle 的配置吗?

from flutter_distributor.

hfbi360 avatar hfbi360 commented on August 22, 2024

可以提供一下你的 build.gradle 的配置吗?

好的。下面是app模块下的build.gradle内容

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    applicationId rootProject.ext.app["applicationId"]
    minSdkVersion rootProject.ext.android["minSdkVersion"]
    targetSdkVersion rootProject.ext.android["targetSdkVersion"]
    versionCode rootProject.ext.app["versionCode"]
    versionName rootProject.ext.app["versionName"]
    manifestPlaceholders = [TENCENT_APP_ID: "appId"]
    multiDexEnabled true
    ndk{
        abiFilters "armeabi-v7a","arm64-v8a"
    }

    configurations.all {
        resolutionStrategy {
            force 'androidx.core:core:1.6.0'
            force 'androidx.core:core-ktx:1.6.0'
        }
    }

}

signingConfigs {
    debug {
        storeFile file(project.hasProperty('RELEASE_STORE_FILE') ? RELEASE_STORE_FILE : System.getenv('RELEASE_STORE_FILE'))
        storePassword project.hasProperty('RELEASE_STORE_PASSWORD') ? RELEASE_STORE_PASSWORD : System.getenv('RELEASE_STORE_PASSWORD')
        keyAlias project.hasProperty('RELEASE_KEY_ALIAS') ? RELEASE_KEY_ALIAS : System.getenv("RELEASE_KEY_ALIAS")
        keyPassword project.hasProperty('RELEASE_KEY_PASSWORD') ? RELEASE_KEY_PASSWORD : System.getenv("RELEASE_KEY_PASSWORD")
        // No debug config

    }

    release {
        storeFile file(RELEASE_STORE_FILE)
        storePassword RELEASE_STORE_PASSWORD
        keyAlias RELEASE_KEY_ALIAS
        keyPassword RELEASE_KEY_PASSWORD

    }
}


buildTypes {
    debug {
        minifyEnabled false
        zipAlignEnabled false
        // 移除无用的resource文件
        shrinkResources false
        signingConfig signingConfigs.debug
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        ndk {
            abiFilters "armeabi", "armeabi-v7a","arm64-v8a"
        }
    }

    profile {
        minifyEnabled false
        zipAlignEnabled false
        // 移除无用的resource文件
        shrinkResources false
        signingConfig signingConfigs.debug
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        ndk {
            abiFilters "armeabi", "armeabi-v7a","arm64-v8a"
        }
    }

    release {
        minifyEnabled true
        zipAlignEnabled true
        // 移除无用的resource文件
        shrinkResources true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        ndk{
            abiFilters "armeabi-v7a","arm64-v8a"
        }
    }
}


lintOptions {
    disable 'InvalidPackage'
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false

}

flavorDimensions "mode"

productFlavors {
    huiwei {}
}

// 自定义APK安装包名
applicationVariants.all { variant ->
    variant.outputs.all { output ->
        def outputFile = output.outputFile
        if (outputFile != null && outputFile.name.endsWith('.apk')) {
            def fileName = "student_v${defaultConfig.versionName}_${buildTime()}.apk"
            outputFileName = fileName
        }
    }
}


buildFeatures {
    dataBinding = true
}

}

def buildTime() {
return new Date().format("yyyy-MM-dd HH:MM:ss" , TimeZone.getTimeZone("UTC"))
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation ('com.github.bumptech.glide:glide:4.11.0') {
exclude group: "com.android.support"
}
kapt 'com.github.bumptech.glide:compiler:4.11.0'
}

from flutter_distributor.

lijy91 avatar lijy91 commented on August 22, 2024

@hfbi360 看起来是因为 build.gradle 中增加了自定义APK安装包名的配置,导致输出目录不是默认目录导致,请移除这部分配置后重试

from flutter_distributor.

lijy91 avatar lijy91 commented on August 22, 2024

请更新到 0.3.3 后重试

from flutter_distributor.

hfbi360 avatar hfbi360 commented on August 22, 2024

请更新到 0.3.3 后重试

多谢

from flutter_distributor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.