Android Studio HiDPI support for Linux - android-studio

I'm struggling with HiDPI support of Android Studio 2.1.3 for Linux Mint. What I know it should be possible to enable Android Studio's HiDPI support by adding -Dhidpi=true flag to /opt/android-studio/bin/studio64.vmoptions Unfortunately it doesn't change anything on my machine, the UI is still very small.

I had the same problem, and I did not manage to "enable" hidpi for Android Studio.
Therefore, I run Android Studio like so:
$ xrandr --dpi 192; android-studio&
Or whatever you prefer instead of 192, of course.

Android Studio 2.3 has HiDPI support out of the box

Related

Is it the normal behaviour for Android Studio to lose all settings after an upgrade via Jetbrains Toolbox?

I'm currently using Android Studio Chipmunk 2021.2.1 Patch 2 212.5712.43.2112.8815526, and would like to upgrade to the latest Android Studio Dolphin 2021.3.1.
Jetbrains Toolbox is providing an option for this upgrade.
However, when the new version gets installed and I open Android Studio, all the settings that I had before are lost, and it looks like a fresh install.
Plugins, themes, are all lost, and it seems like I need to re-install them.
Thankfully I'm able to rollback to the previous version for now.
In other Jetbrains IDEs, there's usually a prompt to migrate over from a previous installation. This isn't coming up with Android Studio.
Is this the normal behaviour for Android Studio? And if not, is there something I'm missing?
More details:
Current Android Studio version: Android Studio Chipmunk 2021.2.1 Patch 2 212.5712.43.2112.8815526
Current Jetbrains Toolbox App version: 1.26.0.13072
OS: macOS Monterey Version 12.5.1 (21G83)

Android Studio - Where is Kotlin installed?

I have macosx and I would like to use kotlin from terminal. Then I would like to find where is kotlin installed, since I'm using it from Android Studio.
I know i can install Kotlin using homebrew but I want avoid having two copies of Kotlin.
The kotlin that is bundled with AS can be found here
/Applications/Android\ Studio.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc
I have Android Studio installed and I found the Kotlin location within ~/home/<user>/AS/plugins/Kotlin/kotlinc/bin.
Current OS : Ubuntu
For Windows 10 (Android 4.1 at least)
C:\Users\<User>\AppData\Roaming\Google\AndroidStudio4.1\plugins\Kotlin\kotlinc\bin\kotlinc.bat

Run Android Studio with Java 8

Since a plugin for IntelliJ (Upsource) requires Java 8 I'd like to run my Android Studio with Java 8 on a Mac.
I could setup JAVA_HOME and start Android Studio from terminal but this is very inconvenient. I'd like to start Android Studio from the OSX UI.
I did not find a way how to specify the JAVA_HOME with Android Studio settings. Moreover this link (https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under) says nothing about Android Studio.
Does anyone know where to configure the Runtime-JDK/JRE for Android Studio 2.1 on OSX without setting any JAVA_HOME?
From http://tools.android.com/tech-docs/configuration
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk
You can also have a look here: http://tools.android.com/tech-docs/configuration/osx-jdk it explains how to set the jre for running android-studio and the jdk for your android project.
In short, you can in a terminal:
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
open /Applications/Android\ Studio.app
And it will launch android_studio with the jdk8
EDIT: from comment #Soccertrash
You can persist the STUDIO_JDK variable via launchctl:
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk<version>

Android Studio 2.1.2 'Dump Java Heap' Not working (Mac OS El Capitan)

I am trying to get an .hprof file using the 'dump java heap' button in Android Studio memory monitor, but for some reason no .hprof file is generated. Does anybody know why? Allocation Tracking works okay.
It does not work for me either, on Android Studio v2.3.3 on Linux. It is a silent failure with no log or error that I can find. This workaround works on my system:
adb [-d|-e] shell am dumpheap <package-name> /sdcard/heapdump.nhprof
adb [-d|-e] pull /sdcard/heapdump.nhprof
<path-to-AndroidSDK>/platform-tools/hprof-conv heapdump.nhprof heapdump.hprof
And then you can drag the heapdump.hprof file onto Android Studio and it will analyze and display it. Choose -d or -e depending whether you are using a USB connected device, or the emulator. Replace with your package name (usually starts with com. or org. )
Update to the newest Android Studio and macOS version. The memory dump works for me for Android Studio 2.3.2 and macOS Sierra 10.12.6.
You can try to increase memory for JVM by set your Android Studio configuration.
Add following settings
-Xms128m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=200m
-XX:+UseCompressedOops
to
/Applications/Android\ Studio.app/Contents/bin/studio.vmoptions

Android Studio / AVD with bumblebee / nvidia optimus

When using a computer with linux and a nvidia optimus graphics card for Android Development, is it possible to tell Intellij / Android Studio to launch the Android Virtual Devices with bumblebee?
Yes, it is possible. I do that by using optirun but running avd and android studio separately.
For example, if you have an Android Wear image just run:
optirun ~/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Android_Wear_Square_API_<api version>
Works with regular android images as well. Its exactly the same command you use to get avd up and running via command line but you just need to prepend optirun to run it with your nvidia card.
After you do that, Android Studio will detect the emulator when you try to build and run your app, even if you don't run Android Studio using optirun.
Sources:
AVD cli docs
Optirun Docs: ArchWiki, UbuntuWiki.
Hope it helps!

Resources