【Android学习】Android studio环境搭建-解决下载gradle慢加载mainfest.xml慢的问题

news2024/9/19 10:41:32

转载:https://blog.csdn.net/qq_31881469/article/details/78646406/

目录

1、解决网络连接问题

(1)问题描述 

(2)方法步骤 

2、解决内存吃紧问题 

(1)问题描述 

(2)方法步骤 

3、解决构建速度慢问题 

(1)问题描述 

(2)方法 


 

1、解决网络连接问题

这里写图片描述

(1)问题描述 

        检查你的 Android SDK,卡上很长时间,需要更新则需要进行安装。

(2)方法步骤 

①跳过这一步,可在Android Studio安装目录下的 bin 目录下,找到 idea.properties 文件,在文件最后追加disable.android.first.run=true 。 

# Use ${idea.home.path} macro to specify location relative to IDE installation home.
# Use ${xxx} where xxx is any Java property (including defined in previous lines of this file) to refer to its value.
# Note for Windows users: please make sure you're using forward slashes: C:/dir1/dir2.

#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the settings directory.
#---------------------------------------------------------------------
# idea.config.path=${user.home}/.AndroidStudio/config

#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the caches directory.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.AndroidStudio/system

#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the user-installed plugins directory.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins

#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the logs directory.
#---------------------------------------------------------------------
# idea.log.path=${idea.system.path}/log

#---------------------------------------------------------------------
# Maximum file size (in KiB) IDE should provide code assistance for.
# The larger file is the slower its editor works and higher overall system memory requirements are
# if code assistance is enabled. Remove this property or set to very large number if you need
# code assistance for any files available regardless of their size.
#---------------------------------------------------------------------
idea.max.intellisense.filesize=2500

#---------------------------------------------------------------------
# Maximum file size (in KiB) the IDE is able to open.
#---------------------------------------------------------------------
idea.max.content.load.filesize=20000

#---------------------------------------------------------------------
# This option controls console cyclic buffer: keeps the console output size not higher than the specified buffer size (KiB).
# Older lines are deleted. In order to disable cycle buffer use idea.cycle.buffer.size=disabled
#---------------------------------------------------------------------
idea.cycle.buffer.size=1024

#---------------------------------------------------------------------
# Configure if a special launcher should be used when running processes from within IDE.
# Using Launcher enables "soft exit" and "thread dump" features
#---------------------------------------------------------------------
idea.no.launcher=false

#---------------------------------------------------------------------
# To avoid too long classpath
#---------------------------------------------------------------------
idea.dynamic.classpath=false

#---------------------------------------------------------------------
# Uncomment this property to prevent IDE from throwing ProcessCanceledException when user activity
# detected. This option is only useful for plugin developers, while debugging PSI related activities
# performed in background error analysis thread.
# DO NOT UNCOMMENT THIS UNLESS YOU'RE DEBUGGING IDE ITSELF. Significant slowdowns and lockups will happen otherwise.
#---------------------------------------------------------------------
#idea.ProcessCanceledException=disabled

#---------------------------------------------------------------------
# There are two possible values of idea.popup.weight property: "heavy" and "medium".
# If you have WM configured as "Focus follows mouse with Auto Raise" then you have to
# set this property to "medium". It prevents problems with popup menus on some
# configurations.
#---------------------------------------------------------------------
idea.popup.weight=heavy

#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under Windows.
#---------------------------------------------------------------------
sun.java2d.d3d=false

#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation on Java 8+.
#---------------------------------------------------------------------
swing.bufferPerWindow=true

#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under X Window.
#---------------------------------------------------------------------
sun.java2d.pmoffscreen=false

#---------------------------------------------------------------------
# Enables HiDPI support in JBR
#---------------------------------------------------------------------
sun.java2d.uiScale.enabled=true

#---------------------------------------------------------------------
# Applicable to the Swing text components displaying HTML (except JEditorPane).
# Rebases CSS size map depending on the component's font size to let relative
# font size values (smaller, larger) scale properly. JBR-only.
#---------------------------------------------------------------------
javax.swing.rebaseCssSizeMap=true


#---------------------------------------------------------------------
# Workaround for accessing (in terms of a11y) long VCS logs on macOS. JBR-only.
#---------------------------------------------------------------------
sun.awt.mac.a11y.tableAccessibleRowCountThreshold=1000

#---------------------------------------------------------------------
# Enabling an optimization that excludes traversal of collapsed accessible nodes from the accessible tree. JBR-4167
#---------------------------------------------------------------------
javax.swing.JTree.excludeAccessibleChildrenFromClosedNodes=true

#---------------------------------------------------------------------
# Workaround to avoid long hangs while accessing clipboard under Mac OS X.
#---------------------------------------------------------------------
#ide.mac.useNativeClipboard=True

#---------------------------------------------------------------------
# Maximum size (KiB) the IDE will use to show historical file contents -
# in Show Diff or when calculating Digest Diff
#---------------------------------------------------------------------
#idea.max.vcs.loaded.size.kb=20480

#---------------------------------------------------------------------
# IDEA file chooser peeks inside directories to detect whether they contain a valid project
# (to mark such directories with a corresponding icon).
# Uncommenting the option prevents this behavior outside the user home directory.
#---------------------------------------------------------------------
#idea.chooser.lookup.for.project.dirs=false

#---------------------------------------------------------------------
# Experimental options that do a number of things to make truly smooth scrolling possible:
#
# * Enables hardware-accelerated scrolling.
#     Blit-acceleration copies as much of the rendered area as possible and then repaints only newly exposed region.
#     This helps to improve scrolling performance and to reduce CPU usage (especially if drawing is compute-intensive).
#
# * Enables "true double buffering".
#     True double buffering is needed to eliminate tearing on blit-accelerated scrolling and to restore
#     frame buffer content without the usual repainting, even when the EDT is blocked.
#
# * Adds "idea.true.smooth.scrolling.debug" option.
#     Checks whether blit-accelerated scrolling is feasible, and if so, checks whether true double buffering is available.
#
# * Enables handling of high-precision mouse wheel events.
#     Although Java 7 introduced MouseWheelEven.getPreciseWheelRotation() method, JScrollPane doesn't use it so far.
#     Depends on the Editor / General / Smooth Scrolling setting, remote desktop detection and power save mode state.
#     Ideally, we need to patch the runtime (on Windows, Linux and macOS) to improve handling of the fine-grained input data.
#     This feature can be toggled via "idea.true.smooth.scrolling.high.precision" option.
#
# * Enables handling of pixel-perfect scrolling events.
#     Currently, this mode is available only under macOS with JetBrains Runtime.
#     This feature can be toggled via "idea.true.smooth.scrolling.pixel.perfect" option.
#
# * Enables interpolation of scrolling input (scrollbar, mouse wheel, touchpad, keys, etc).
#     Smooths input, which lacks both spatial and temporal resolution, performs the rendering asynchronously.
#     Depends on the Editor / General / Smooth Scrolling setting, remote desktop detection and power save mode state.
#     The feature can be tweaked using the following options:
#       "idea.true.smooth.scrolling.interpolation" - the main switch
#       "idea.true.smooth.scrolling.interpolation.scrollbar" - scrollbar interpolation
#       "idea.true.smooth.scrolling.interpolation.scrollbar.delay" - initial delay for scrollbar interpolation (ms)
#       "idea.true.smooth.scrolling.interpolation.mouse.wheel" - mouse wheel / touchpad interpolation
#       "idea.true.smooth.scrolling.interpolation.mouse.wheel.delay.min" - minimum initial delay for mouse wheel interpolation (ms)
#       "idea.true.smooth.scrolling.interpolation.mouse.wheel.delay.max" - maximum initial delay for mouse wheel interpolation (ms)
#       "idea.true.smooth.scrolling.interpolation.precision.touchpad" - touchpad interpolation
#       "idea.true.smooth.scrolling.interpolation.precision.touchpad.delay" - initial delay for touchpad interpolation (ms)
#       "idea.true.smooth.scrolling.interpolation.other" - interpolation of other input sources
#       "idea.true.smooth.scrolling.interpolation.other.delay" - initial delay for other input source interpolation (ms)
#
# * Adds on-demand horizontal scrollbar in editor.
#     The horizontal scrollbar is shown only when it's actually needed for currently visible content.
#     This helps to save editor space and to prevent occasional horizontal "jitter" on vertical touchpad scrolling.
#     This feature can be toggled via "idea.true.smooth.scrolling.dynamic.scrollbars" option.
#---------------------------------------------------------------------
#idea.true.smooth.scrolling=true

#---------------------------------------------------------------------
# The VM option value to be used to start a JVM in debug mode.
# Some JREs define it in a different way (-XXdebug in Oracle VM)
#---------------------------------------------------------------------
idea.xdebug.key=-Xdebug

#-----------------------------------------------------------------------
# Change to 'enabled' if you want to receive instant visual notifications
# about fatal errors that happen to an IDE or plugins installed.
#-----------------------------------------------------------------------
idea.fatal.error.notification=disabled

disable.android.first.run=true

②或者:使用墙外代理。

2、解决内存吃紧问题 

(1)问题描述 

        Android Studio 安装目录的-xmx 参数是 Java 虚拟机启动时的参数,用于限制最大堆内存。Android Studio 启动时设置了这个参数,并且默认值很小。 一旦你的工程变大,IDE 运行时间稍长,内存就开始吃紧,频繁触发 GC,自然会卡。

(2)方法步骤 

        每次升级/安装 Android Studio 之后都修改android-studio/bin/studio64.exe.vmoptions studio64.vmoptions 两个文件的以下属性: 

-Xms2048m 
-Xmx2048m 
-XX:MaxPermSize=2048m 
-XX:ReservedCodeCacheSize=2048m

-XX:+IgnoreUnrecognizedVMOptions
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
-Dsun.io.useCanonCaches=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Djdk.module.illegalAccess.silent=true
-Djna.nosys=true
-Djna.boot.library.path=
-Didea.vendor.name=Google
-Dkotlinx.coroutines.debug=off

3、解决构建速度慢问题 

(1)问题描述 

        随着项目的增大,依赖库的增多,构建速度越来越慢,现在最慢要6分钟才能build一个release的安装包

(2)方法 

        开启gradle单独的守护进程,增大gradle运行的java虚拟机的大小,让gradle在编译的时候使用独立进程,让gradle可以平行的运行。


①在下面的目录下面创建gradle.properties文件:C:\Users\.gradle (Windows)

②在文件中增加:org.gradle.daemon=true

③优化以上用户目录下的gradle.properties文件,配置如下:

# Project-wide Gradle settings.
 
# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
 
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
 
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true
 
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
 
# Enables new incubating mode that makes Gradle selective when configuring projects. 
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/565808.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

chatgpt赋能python:Python的SEO优化

Python的SEO优化 介绍 Python是一种高级编程语言,旨在提高开发人员的生产力和代码可读性。在过去的10年中,Python已迅速成为最受欢迎的编程语言之一,具有广泛的应用领域,包括数据科学、机器学习、人工智能、网络编程和Web开发。…

chatgpt赋能python:Python集合的差集

Python集合的差集 Python是一门强大的动态语言,不仅应用于广泛的领域,而且它还拥有非常丰富的数据结构。Python中的集合(set)是一种无序、不重复元素的结构,常用于去重,检查成员等操作。 在Python中,可以使用"-…

Java面试知识点(全)-分布式算法- ZAB算法

Java面试知识点(全) 导航: https://nanxiang.blog.csdn.net/article/details/130640392 注:随时更新 研究zookeeper时,必须要了解zk的选举和集群间个副本间的数据一致性。 什么是 ZAB 协议? ZAB 协议介绍 ZAB 协议全称&#xf…

docker安装mysql8.0.33

1 从docker仓库中拉去mysql 8.0 docker pull mysql:8.0如果使用 docker pull mysql 默认拉取的是最新版本的mysql 上面我拉去的是8.0的版本,最后拉取过来的是8.0.33 如果有想要指定的版本,可以直接写指定版本,如: docker pull my…

Python速查表;腾讯大佬的AIGC设计应用汇总;这个世界需要10亿开发者;67个最常用AI工具清单 | ShowMeAI日报

👀日报&周刊合集 | 🎡生产力工具与行业应用大全 | 🧡 点赞关注评论拜托啦! 🤖 『一份必收藏的 Python 3 速查表』可运行代码中文注释 随着AIGC浪潮的兴起,越来越多小伙伴尝试着使用 GPT 类工具开发小程…

如何通过提高技能来克服 IT 技能差距

有时招聘很容易,你发布了职位描述,然后突然被热切的、合格的候选人淹没了。 特别是对于技术职位,招聘前景从未如此黯淡。谈论信息技术 (IT) 人才缺口是不可避免的,并且有充分的理由:根据研究,73% 的企业领…

chatgpt赋能python:Python%2:优化你的代码

Python %2:优化你的代码 Python是一门强大的编程语言,被广泛应用于数据分析、机器学习、Web开发等领域。在Python的语法中,有一个运算符%用于格式化字符串,在本篇文章中,我们将聚焦于%2的应用,以帮助读者优…

三层交换机

管理vlan 远程连接一个二层交换机,由于二层交换机不能配IP地址,所以我们使用SVI交换虚拟接口配置一个IP地址来远程连接二层交换机。svi接口可以配置ip地址,出厂存在mac地址,用于远程登陆管理该设备,该接口默认在vlan1…

如何在华为OD机试中获得满分?Java实现【最多提取子串数目】一文详解!

✅创作者:陈书予 🎉个人主页:陈书予的个人主页 🍁陈书予的个人社区,欢迎你的加入: 陈书予的社区 🌟专栏地址: 华为OD机试攻略:Java实现并讲解2022&2023真题 文章目录 1. 题目描述2. 输入描述…

配电室智能监控系统设计及实现分析

摘 要:配电室作为电网正常运行中的基础性设施,在信息化建设中处于信息交换管理的核心位置,这就要求配电室内所有设备须时时刻刻正常运转,一旦某台设备出现故障,对数据传输、存储及系统运行构成威胁,就会影…

代码随想录算法训练营第五十一天 | 买卖股票3

309.最佳买卖股票时机含冷冻期 文档讲解:代码随想录 (programmercarl.com) 视频讲解:动态规划来决定最佳时机,这次有冷冻期!| LeetCode:309.买卖股票的最佳时机含冷冻期_哔哩哔哩_bilibili 状态:dp定义看的…

Microsoft Office 2019安装

哈喽,大家好。今天一起学习的是office2019的安装,有兴趣的小伙伴也可以来一起试试手。 一、测试演示参数 演示操作系统:Windows 10 支持Win11安装,不支持Win7、XP系统 系统类型:64位 演示版本:cn_office_…

【C++】——动态内存管理

目录 🌞导读 🌔C/C内存分布 🌔C内存管理方式 🌗new/delete操作内置类型 🌗new和delete的使用方法 🌔operator new与operator delete函数 🌔new和delete的实现原理 🌗内置…

Python篇——数据结构与算法(第三部分:归并排序;快速、归并、堆排序小结;深拷贝和浅拷贝区别)

1、归并排序——归并 假设现在的列表分为两段有序,如何将其合成为一个有序列表这种操作称为一次归并 归并过程描述:(前提是两段列表分别有序) 两段有序列表进行对比,1和2进行对比选出最小的数,1出列&#x…

chatgpt赋能python:Python中的soup.find()方法详解

Python中的soup.find()方法详解 Python语言的简洁、易读性和快速开发的特点已经成为了程序员们的首选语言。其中,BeautifulSoup库作为一个非常好用的库,可以用于解析HTML/XML文档,提取出需要的信息。soup.find()方法是BeautifulSoup库中的一…

chatgpt赋能python:PythonWord目录的介绍

Python Word 目录的介绍 Python 是一种高级编程语言,已经成为世界上最流行的程序设计语言之一。在 Python 中,我们可以使用一些库和模块来完成各种任务,例如文本处理和文件操作。 一个很常见的文本处理任务就是生成和编辑 Microsoft Word 文…

day1 - OpenCV安装与环境配置

本期我们介绍 OpenCV 的背景知识以及如何安装 OpenCV 。 完成本期内容,你可以: 了解 OpenCV 的背景知识掌握安装 OpenCV 及其拓展库 若要运行案例代码,你需要有: 操作系统:Ubuntu 16 以上 或者 Windows10 工具软件…

chatgpt赋能python:PythonTables:为你的数据处理带来更高效的解决方案

Python Tables:为你的数据处理带来更高效的解决方案 Python是一种功能强大且易于使用的编程语言,可以用于各种用途。对于数据处理和分析来说,Python是一个非常受欢迎的选择,因为它有许多强大的库和工具可以使用。其中一个很有用的…

pkcs8-rfc5958

非对称密钥包摘要 本文档定义了私钥信息的语法及其内容类型。 私钥信息包括指定公钥算法的私钥和一组属性。 RFC 5652 中定义的加密消息语法 (CMS) 可用于对非对称密钥格式内容类型进行数字签名、摘要、验证或加密。 本文档废弃了 RFC 5208。 本备忘录的状态 这是一份 Internet…

多线程详解(理论与实践的最佳融合方案)

一.概述 线程简介 总而言之,就是在同一时间,做了不同的事情,正所谓一石二鸟,一箭双雕,赔了夫人又折兵 生活中很多事情都可以看作是多线程的例子。比如: 煮饭:煮饭需要同时加热米饭和煮菜&#…