Android in IntelliJ IDEA development story

For a fair amount of time, I thrive to do something for Android. Some funny genius staff, as I usually like to. I’ve tried Android Studio 2.1.something, pecked at it a little, tried several lessons and put it aside. While installing I hit the bug with a non-ASCII path to installation, reinstalled several times. At some point a had to clean up my system (Windows 7) and reset entire notebook to its factory settings. Then I installed Android Studio again, worked with it little more, installed concurring IntelliJ IDEA, worked in it without Android.

They periodically updated, I added SDKs and virtual devices and for yesterday I had a unmaintainable chunk of installations, where I did not know, what uses what, with probable duplications and dead data. Unable to run debug on a virtual device for IntelliJ IDEA, I uninstalled all I could and deleted the rest. All Android, all Android SDK and so on. It freed me about 50 GB of space. Fifty OMG GB!

Now I chose to use IntelliJ IDEA only, so I went by steps from manual carefully avoiding any space-wasting.

First, I installed Java SE Development Kit, it was 8u131 version, not 7, as IntelliJ recommends, but there is version 7 too somewhere already installed. Somehow.

Then I downloaded ZIP file with Android command line tools. I did wrong and tried to keep version info in a folder name (C:\Android\sdk-tools_r25.2.3-windows). So, when i tried to install tools from sdkmanager.bat C:\Android\sdk-tools_r25.2.3-windows\bin>sdkmanager "tools", it made directory C:\Android\tools and some more, I did not want.

So I uninstalled those tools C:\Android\sdk-tools_r25.2.3-windows\bin>sdkmanager --uninstall "tools", deleted content of C:\Android\ and unzipped folder tools once more. This time as it was in the archive. I also deleted .android folder from my home folder. Then, looking at manual page https://developer.android.com/studio/intro/update.html I started to install packages.

I made a text file with the next content (I decided to start with SDKs version 24.0.0 :

build-tools;24.0.0
platforms;android-24
tools
emulator

Not much, but sdkmanager writes some packages like that:
extras;m2reposi...ut-solver;1.0.0
making them hard to understand. I decided I’ll install the rest from the IntelliJ IDEA later. So, I ran:
sdkmanager --package_file=my_file
and confirmed it with ‘y’ for yes. It took awhile. But at the end, there was an error about an inability to move or rename tools folder. So, I cleaned up all again, and run from Android folder:
C:\Android\>tools\bin\sdkmanager --package_file=my_file
Nothing has changed, so I renamed tools to tools_inst and run:
C:\Android\>tools_inst\bin\sdkmanager --package_file=my_file
without clean up, because why. Three warnings and waiting…

Something is “done” and I am happy. But not quite. So I’ve decided to clean up once more and try again. This time tools again, but only –update. Again error with rename. So, I just unzipped tools to C:\Android\android_sdk\tools.

Now IntelliJ 2017.1 Community version. Downloaded, started the installation, finished the installation, run IDEA and there was Android! But, for there were no SDK, I run Configure – Project Defaults – Project Structure – SDKs (there was a hint). In prompt, I entered home for Java (C:\Program Files\Java\jdk1.8.0_131) and C:\Android\android_sdk as the home directory for SDK would not do. So, I returned to SDK installation with tools_inst and repeating of

C:\Android\android_sdk\tools_inst\bin\>sdkmanager --update
C:\Android\android_sdk\tools_inst\bin\>sdkmanager --package_file=my_file

Now IntelliJ IDEA accepted C:\Android\android_sdk as the home directory for Android SDK. Oh, God!

To be continued…

2 thoughts on “Android in IntelliJ IDEA development story

Leave a comment