【问题标题】:New gradle version doesnot have dependencies section in App level build.gradle新的 gradle 版本在 App 级别 build.gradle 中没有依赖项部分
【发布时间】:2020-11-08 01:40:22
【问题描述】:

新的 gradle 版本在 App 级别 build.gradle 中没有依赖项部分 我想添加 FB 登录包的实现以及其他一些包,但是有 没有依赖项部分,但它工作正常。它是一个颤动的项目。我使用的 gradle 版本是 6.5.1

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  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'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 29

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "MY APP ID"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

【问题讨论】:

    标签: android android-studio flutter gradle build.gradle


    【解决方案1】:

    在flutter下面添加依赖部分:

    flutter {
        source '../..'
    }
    //here
    dependencies {
        ...
    }
    

    还有一个link 给文档。

    【讨论】:

    • 等我自己能做到吗??
    • 我以为有问题,它没有在它的 on 上添加。
    • 如果它解决了问题,别忘了接受答案。
    猜你喜欢
    • 2021-02-07
    • 2023-02-06
    • 2019-03-03
    • 1970-01-01
    • 1970-01-01
    • 2017-08-29
    • 2021-12-18
    • 1970-01-01
    • 2017-08-01
    相关资源
    最近更新 更多