突然在 Android Studio 中遇到了这个问题。在 Android Studio 3.2 和 3.3 版本中都尝试过同样的问题。应用程序在 Android 模拟器中正常运行,但不适用于真正的 Android 设备。尝试运行应用程序时显示此错误:
Error during Sync: Broken pipe
Session 'app': Error Installing APK
试过这个但不适合我。按照他们的指示更新了studio.vmoptions
和idea.propertis
文件,但仍然没有运气。这是更新的studio.vmoptions
文件:
-Xmx2048m
-Xms256m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-Djava.net.preferIPv6Addresses=true
和idea.propertis
文件:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure
# you're using forward slashes.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins
#---------------------------------------------------------------------
# Maximum file size (kilobytes) 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 their size.
#---------------------------------------------------------------------
idea.max.intellisense.filesize=2500
#---------------------------------------------------------------------
# This option controls console cyclic buffer: keeps the console output size not higher than the
# specified buffer size (Kb). 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
#---------------------------------------------------------------------
# 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
#---------------------------------------------------------------------
# Use default anti-aliasing in system, i.e. override value of
# "Settings|Editor|Appearance|Use anti-aliased font" option. May be useful when using Windows
# Remote Desktop Connection for instance.
#---------------------------------------------------------------------
idea.use.default.antialiasing.in.editor=false
#---------------------------------------------------------------------
# Disabling this property may lead to visual glitches like blinking and fail to repaint
# on certain display adapter cards.
#---------------------------------------------------------------------
sun.java2d.noddraw=true
#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under Windows.
#---------------------------------------------------------------------
sun.java2d.d3d=false
#---------------------------------------------------------------------
# Workaround for slow scrolling in JDK6
#---------------------------------------------------------------------
swing.bufferPerWindow=false
#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under X Window.
#---------------------------------------------------------------------
sun.java2d.pmoffscreen=false
#---------------------------------------------------------------------
# Workaround to avoid long hangs while accessing clipboard under Mac OS X.
#---------------------------------------------------------------------
# ide.mac.useNativeClipboard=True
#---------------------------------------------------------------------
# Maximum size (kilobytes) IDEA will load for showing past file contents -
# in Show Diff or when calculating Digest Diff
#---------------------------------------------------------------------
# idea.max.vcs.loaded.size.kb=20480
和gradle.properties
文件:
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8