flutter在使用gradle时的加速

ops/2025/1/20 23:00:25/

当我使用了一些过时的插件的时候,遇到了一些问题
比如什么namespace 问题等,因为有些插件库没有更新了,或者最新版本处于测试阶段

于是我就删除这些旧插件(不符合我要求的插件)

于是根据各论坛的解决方法去做了以下的工作
1:项目中删除了这些插件
2:项目中删除了这些引用
3:删除了gradle的缓存
4:更换了新版本的gradle的版本
5:清除flutter缓存
6:重新下载构建插件
7:运行后报错

这个办法居然行不通,还是报错,于是我又得重新创建新项目

重新构建项目时总是需要很长的时间去下载插件,那么它就经常报错

报错–链接超时

那么就要设置这个个gradle的连接网络的端口

D:\F\lvjun\android\gradle.properties
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
systemProp.http.proxyHost=192.168.1.2
systemProp.http.proxyPort=1082
systemProp.https.proxyHost=192.168.1.2
systemProp.https.proxyPort=1082

这么设置之后,gradle的连接就快了

插件配置列表

name: lvjun
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1environment:sdk: ^3.6.0# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:flutter:sdk: flutter# The following adds the Cupertino Icons font to your application.# Use with the CupertinoIcons class for iOS style icons.cupertino_icons: ^1.0.8dev_dependencies:flutter_test:sdk: flutter# The "flutter_lints" package below contains a set of recommended lints to# encourage good coding practices. The lint set provided by the package is# activated in the `analysis_options.yaml` file located at the root of your# package. See that file for information about deactivating specific lint# rules and activating additional ones.flutter_lints: ^5.0.0#------------------------------------# google_fonts 超过 977 种字体(及其变体)google_fonts: ^6.2.1#------------------------------------# http请求http: ^1.2.2# dio库是 http 请求库,不使用普通的http 库# 【Dio 更专注于网络请求和相关功能,是一个功能强大的 HTTP 客户端。】dio: ^5.7.0#  用于 Dio 软件包的灵活重试库。dio_smart_retry: ^7.0.1# get: ^4.6.6 【Get 则是一个多合一的框架库,除了基本的网络请求,还包括了状态管理、路由管理、依赖注入等。】get: ^4.6.6#------------------------------------# 打开文件open_file: ^3.5.10# 状态管理provider: ^6.1.2# path_provider 用于在文件系统上查找常用位置。path_provider: ^2.1.5#为简单数据封装特定于平台的持久性存储,数据可以异步保存到磁盘, 并且不能保证写入在 returning,因此此插件不得用于存储关键数据。shared_preferences: ^2.3.4#显示富文本内容库(使用flutter_widget_from_html显示富文本内容)flutter_widget_from_html: ^0.15.3# 使用url_launcher处理链接跳转url_launcher: ^6.3.1#------------------------------------# 缓存管理#  cached_network_image: ^3.4.1【降低版本】cached_network_image: ^3.4.1#------------------------------------# 数据库sqlite3: ^2.6.0sqflite: ^2.4.1sqflite_common_ffi: ^2.3.4+4#------------------------------------# 加密+数学# vector_math用于 2D 和 3D 应用程序的 Vector 数学库。vector_math: ^2.1.4crypto: ^3.0.6#  crypto: ^3.0.6 Dart 的一组加密哈希函数。uuid: ^4.5.1# uuid: ^4.5.1按字典顺序排序的 128 位标识符 (UUID),具有 48 位时间戳和 80 个随机位。#  规范编码为 26 个字符的字符串,而不是 36 个字符的 UUID。#------------------------------------# 同步与异步#同步库 基本锁定机制,用于防止并发访问异步代码。synchronized: ^3.3.0+3#------------------------------------# 日志logger: ^2.5.0#------------------------------------## 音频播放  音频播放功能完善,支持多种格式just_audio: ^0.9.42# just_audio 依赖如下audio_session: ^0.1.23# crypto: ^3.0.6# path_provider: ^2.1.5just_audio_platform_interface: ^4.3.0just_audio_web: ^0.4.13#  path_provider: ^2.1.5#  rxdart: ^0.28.0 【降低版本】rxdart: ^0.28.0# uuid: ^4.5.1# just_audio 依赖结束#------------------------------------# 视频播放  Flutter官方维护,稳定性好video_player: ^2.9.2# 依赖video_player_android: ^2.7.17video_player_avfoundation: ^2.6.5video_player_platform_interface: ^6.2.3video_player_web: ^2.3.3# 视频播放fvp: ^0.29.0# 视频播放器控制器   基于 video_player 的封装,提供了更好的UI控制plugin_platform_interface: ^2.1.8# plugin_platform_interface: ^2.1.8 是fvp的依赖#------------------------------------# 播放器的控制#  chewie: ^1.8.5 【降低版本】chewie: ^1.8.5# wakelock_plus: 由 creativecreatorormaybenot 编写的原始唤醒锁 Flutter 插件的延续,它允许您保持设备屏幕处于唤醒状态,# 即防止屏幕休眠。#  wakelock_plus: ^1.2.10【降低版本】wakelock_plus: ^1.2.10#------------------------------------share_plus: ^10.1.3   # 分享链接 share_plus#------------------------------------# 显示网页1#安卓-ios-macOS中显示网页webview_flutter: ^4.10.0webview_flutter_android: ^4.2.0webview_flutter_web: ^0.2.3+4webview_flutter_wkwebview: ^3.17.0# 显示网页2[3中pc平台的支持]desktop_webview_window: ^0.2.3# webview_windows: ^0.4.0 [Windows] 仅支持windows#------------------------------------# 通知1 flutter_local_notifications【支持[Android-iOS-Linux-macOS]flutter_local_notifications: ^18.0.1# 通知2 local_notifier 【支持 [Linux-macOS-Windows]】 依赖【uuid: ^4.5.1】local_notifier: ^0.1.6# uuid: ^4.5.1#------------------------------------
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec# The following section is specific to Flutter packages.
flutter:# The following line ensures that the Material Icons font is# included with your application, so that you can use the icons in# the material Icons class.uses-material-design: true# To add assets to your application, add an assets section, like this:# assets:#   - images/a_dot_burr.jpeg#   - images/a_dot_ham.jpeg# An image asset can refer to one or more resolution-specific "variants", see# https://flutter.dev/to/resolution-aware-images# For details regarding adding assets from package dependencies, see# https://flutter.dev/to/asset-from-package# To add custom fonts to your application, add a fonts section here,# in this "flutter" section. Each entry in this list should have a# "family" key with the font family name, and a "fonts" key with a# list giving the asset and other descriptors for the font. For# example:# fonts:#   - family: Schyler#     fonts:#       - asset: fonts/Schyler-Regular.ttf#       - asset: fonts/Schyler-Italic.ttf#         style: italic#   - family: Trajan Pro#     fonts:#       - asset: fonts/TrajanPro.ttf#       - asset: fonts/TrajanPro_Bold.ttf#         weight: 700## For details regarding fonts from package dependencies,# see https://flutter.dev/to/font-from-package

D:\F\lvjun\android\settings.gradle

pluginManagement {def flutterSdkPath = {def properties = new Properties()file("local.properties").withInputStream { properties.load(it) }def flutterSdkPath = properties.getProperty("flutter.sdk")assert flutterSdkPath != null, "flutter.sdk not set in local.properties"return flutterSdkPath}()includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")repositories {google()mavenCentral()gradlePluginPortal()}
}plugins {id "dev.flutter.flutter-plugin-loader" version "1.0.0"id "com.android.application" version "8.1.0" apply falseid "org.jetbrains.kotlin.android" version "1.8.22" apply false
}include ":app"

flutter版本

PS D:\F\lvjun> flutter --version
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 17025dd882 (4 weeks ago)2024-12-17 03:23:09 +0900
Engine • revision cb4b5fff73
Tools • Dart 3.6.0 • DevTools 2.40.2
PS D:\F\lvjun> 

gradle版本–以及java版本

PS D:\F> gradle -v------------------------------------------------------------
Gradle 8.12
------------------------------------------------------------Build time:    2024-12-20 15:46:53 UTC
Revision:      a3cacb207fec727859be9354c1937da2e59004c1Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  17.0.10 (Microsoft 17.0.10+7-LTS)
Daemon JVM:    C:\Program Files\Microsoft\jdk-17.0.10.7-hotspot (no JDK specified, using current Java home)
OS:            Windows 11 10.0 amd64PS D:\F>

http://www.ppmy.cn/ops/151777.html

相关文章

mysql_real_connect的概念和使用案例

mysql_real_connect 是 MySQL C API 中的一个函数,用于建立一个到 MySQL 数据库服务器的连接。这个函数尝试建立一个到 MySQL 服务器的连接,并返回一个 MYSQL* 类型的指针,这个指针可以用于后续的数据库操作。 函数原型 MYSQL *mysql_real_…

vue项目创建与运行(idea)

一、安装vue 在安装完node.js后 使用管理员身份运行命令行,在命令行中,执行如下指令: npm install -g vue/cli 这个过程中,会联网下载,可能会耗时几分钟,耐心等待。 以管理员身份运行cmd检查版本 idea创…

数据结构漫游记:队列的动态模拟实现(C语言)

嘿,各位技术潮人!好久不见甚是想念。生活就像一场奇妙冒险,而编程就是那把超酷的万能钥匙。此刻,阳光洒在键盘上,灵感在指尖跳跃,让我们抛开一切束缚,给平淡日子加点料,注入满满的pa…

Flutter ListView进阶:如何实现根据索引值滚动到列表特定位置

在Flutter开发中,ListView是一个非常常用的组件,它允许我们展示一系列的项目。然而,有时候我们需要根据特定的索引值滚动到ListView中的某个项目位置,以便提供更好的用户体验。本文将详细介绍如何在Flutter中实现这一功能。 一、…

c++ string

1 sting 基本概念 string 基本概念 本质:string是c风格的字符串,而string 本质上是一个类string 和char* 的区别: char * 是一个指针 string 是一个类,类内部封装了char*,管理这个字符串,是一个char* 数组…

独立看门狗(IWDG)实验【学习记录】

STM32内部自带了 2个看门狗:独立看门狗( IWDG)和窗口看门狗 WWDG)。 我们将通过按键 WK_UP来喂狗,然后通过 DS0提示复位状态。 10.1 STM32独立看门狗简介 40KHZ低速时钟驱动,是一个内部RC时钟&#xff0…

C语言之装甲车库车辆动态监控辅助记录系统

🌟 嗨,我是LucianaiB! 🌍 总有人间一两风,填我十万八千梦。 🚀 路漫漫其修远兮,吾将上下而求索。 C语言之装甲车库车辆动态监控辅助记录系统 目录 一、前言 1.1 (一)…

Elasticsearch:Jira 连接器教程第一部分

作者:来自 Elastic Gustavo Llermaly 将我们的 Jira 内容索引到 Elaasticsearch 中以创建统一的数据源并使用文档级别安全性进行搜索。 在本文中,我们将回顾 Elastic Jira 原生连接器的一个用例。我们将使用一个模拟项目,其中一家银行正在开发…