当前位置: 首页 > 知识库问答 >
问题:

运行Gradle flutter android studio时出错

穆俊名
2023-03-14
buildscript {
    repositories {
        // ...
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.2, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

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

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

    // splits {
    //     abi {
    //         enable true
    //         reset()
    //         include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
    //         universalApk false
    //     }
    // }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.mustafakhaled.buzzchat"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    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

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

}

Android/Build.Gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'

    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

共有1个答案

何雅惠
2023-03-14
flutter doctor
flutter doctor --android-licenses
 类似资料:
  • 当我尝试运行HelloWorld时,我遇到了这个错误。类别 从这个角度看,它似乎试图运行HelloWorld/class。程序只需打印HelloWorld!。 有什么想法吗?

  • 我正在尝试从netbeans外部启动网络服务器。我确实将DERBY_INSTALL变量设置为适当的目录,然后发出setNetworkServerCP命令,该命令也可以正常工作。但是当我尝试运行startNetworkServer时,我得到了以下错误。 C:\Users\tandons D: D:\netbeans\glassfish-v2。1\javadb\bin D:\netbeans\glas

  • 'tools.jar'不在Android Studio类路径中。请确保JAVA_HOME指向JDK而不是JRE 这里有人能帮我吗?

  • 我在上面有一个问题:我使用了提供的答案,但仍然击中了一个对象错误。你能看到我错过了什么吗?我在“cash_sheet.range(”C8“).pastespecial xlpastevalues”处找到了错误

  • 当我启动Android Studio时,我遇到此错误: 当我单击“重试”时,会出现相同的错误:

  • 我使用的是高级的Yii2模板,当我在构建后运行测试时,我遇到了以下问题。 我不知道名字空间是什么,所以请你向我解释一下它是什么。 错误 codeception.yml

  • 我是新的火花,我试图创建一个图形框架,并对这是我的代码做一些查询 但结果显示以下错误: 我怎样才能解决这个问题,谢谢!