flutter在使用gradle时的加速

news/2025/1/19 21:20:52/

当我使用了一些过时的插件的时候,遇到了一些问题
比如什么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/news/1564502.html

相关文章

解决Element Plus el-date-picker组件清空时,触发两次change的问题

问题 el-date-picker 组件在选择日期范围时会触发两次 change 事件。当用户选择了范围的开始时&#xff0c;会立即触发一次 change 事件。而当用户选择了范围的结束时&#xff0c;又会触发一次 change 事件。 解决方法 1. 延迟更新 <template><div>选择日期--{…

Java 高级工程师面试高频题:JVM+Redis+ 并发 + 算法 + 框架

前言 在过 2 个月即将进入 3 月了&#xff0c;然而面对今年的大环境而言&#xff0c;跳槽成功的难度比往年高了很多&#xff0c;很明显的感受就是&#xff1a;对于今年的 java 开发朋友跳槽面试&#xff0c;无论一面还是二面&#xff0c;都开始考验一个 Java 程序员的技术功底…

Node.js --- 模板引擎EJS

1. 前言 模板引擎是一种工具或库&#xff0c;用于在开发中生成动态内容的 HTML 页面。它通过将预定义的模板与数据结合&#xff0c;生成最终的输出&#xff08;如 HTML 页面、字符串等&#xff09;。模板引擎广泛应用于前端和后端开发&#xff0c;尤其是在构建动态网站时。 2.…

CSS中样式继承+优先级

继承属性和非继承属性 一、定义及分类 1、继承属性是指在父元素上设置了这些属性后&#xff0c;子元素会自动继承这些属性的值&#xff0c;除非子元素显式地设置了不同的值。 常见的继承属性: 字体 font 系列文本text-align text-ident line-height letter-spacing颜色 col…

Ubuntu 开启 SMB 服务,并通过 windows 访问

背景资料 Ubuntu服务器折腾集Ubuntu linux 文件权限Ubuntu 空闲硬盘挂载到 文件管理器的 other locations Ubuntu开启samba和window共享文件 Ubuntu 配置 SMB 服务 安装 Samba 确保 Samba 已安装。如果未安装&#xff0c;运行以下命令进行安装&#xff1a; sudo apt upda…

面试题解析

1、写一个sed命令&#xff0c;修改/tmp/input.txt文件的内容 要求&#xff1a; 删除所有空行&#xff1b; 在非空行前面加一个"AAA"&#xff0c;在行尾加一个"BBB"&#xff0c;即将内容为11111的一行改为&#xff1a;AAA11111BBB 创造测试文件&#xff1a;…

计算机网络 | IP地址、子网掩码、网络地址、主机地址计算方式详解

关注&#xff1a;CodingTechWork 引言 在计算机网络中&#xff0c;IP地址、子网掩码和网络地址是构建网络通信的基本元素。无论是企业网络架构、互联网连接&#xff0c;还是局域网&#xff08;LAN&#xff09;配置&#xff0c;它们都起着至关重要的作用。理解它们的工作原理&a…

for循环语句题目

for循环&#xff1a; 1整数的个数 给定k(1<k<100)个正整数&#xff0c;其中每个数都是大于等于1&#xff0c;小于等于10的数。写程序计算给定的k个正整数中&#xff0c;1&#xff0c;5和10出现的次数。 #include <stdio.h> int main(){ int k,n; int sum0;…