flutter3.41.5版本运行不起来程序,配置直接搞定

张开发
2026/4/19 18:27:23 15 分钟阅读

分享文章

flutter3.41.5版本运行不起来程序,配置直接搞定
我们的项目名称叫untitled,项目创建在了flutterapp目录下jdk版本是171.D:\flutterapp\untitled\androidbuild.gradle.ktsplugins{id("com.android.application")id("kotlin-android")// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin")}android{namespace="com.example.untitled"compileSdk=flutter.compileSdkVersion ndkVersion=flutter.ndkVersion compileOptions{sourceCompatibility=JavaVersion.VERSION_17 targetCompatibility=JavaVersion.VERSION_17}kotlinOptions{jvmTarget=JavaVersion.VERSION_17.toString()}defaultConfig{// TODO: Specify your own unique Application ID(https://developer.android.com/studio/build/application-id.html). applicationId="com.example.untitled"// You can update the following values to match your application needs. // Formoreinformation, see: https://flutter.dev/to/review-gradle-config. minSdk=flutter.minSdkVersion targetSdk=flutter.targetSdkVersion versionCode=flutter.versionCode versionName=flutter.versionName}buildTypes{release{// TODO: Add your own signing configforthe release build. // Signing with the debug keysfornow, so`flutter run--release`works. signingConfig=signingConfigs.getByName("debug")}}}flutter{source="../.."}gradle.properties我的jdk目录在E盘的ajdk17目录下org.gradle.jvmargs=-Xmx8G-XX:MaxMetaspaceSize=4G-XX:ReservedCodeCacheSize=512m-XX:+HeapDumpOnOutOfMemoryErrorandroid.useAndroidX=trueorg.gradle.java.home=E:\\\\ajdk17# Mapbox Android SDK 下载(账户 Secret Token,勿提交真实值;也可设环境变量 MAPBOX_DOWNLOADS_TOKEN)# MAPBOX_DOWNLOADS_TOKEN=# SDK_REGISTRY_TOKEN=gradlew#!/usr/bin/env bash################################################################################## Gradle start up script for UN*X################################################################################# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.DEFAULT_JVM_OPTS=""APP_NAME="Gradle"APP_BASE_NAME=`basename"$0"`# Use the maximum available, or set MAX_FD != -1 to use that value.MAX_FD="maximum"warn(){echo"$*"}die(){echoecho"$*"echoexit1}# OS specific support (must be 'true' or 'false').cygwin=falsemsys=falsedarwin=falsecase"`uname`"inCYGWIN*)cygwin=true;;Darwin*)darwin=true;;MINGW*)msys=true;;esac# Attempt to set APP_HOME# Resolve links: $0 may be a linkPRG="$0"# Need this for relative symlinks.while[-h"$PRG"];dols=`ls-ld"$PRG"`link=`expr"$ls":'.*- \(.*\)$'`ifexpr"$link":'/.*'/dev/null;then

更多文章