Migrating Android Dev’s IDE from Eclipse to IntelliJ(2)

In the previous article, I described the installation and basic configuration of IntelliJ IDEA. Android development is ready now. Then I will describe how to use it actually.

Creating a New Project

When you click “Create New Project” in Welcome screen, “New Project” window opens. Select “Application Module” in “Android” section, and specify “Project name” and “Project Location”, then press “Next”.


Enter “Application name”, “Package name” and other requried matters. Then press “Finish”.
Wait for a while, after the Tip of the Day, the project will start.

Importing an Existing Project

If you want to import an existing project, by “Import Project”, specify the folder that contains the source project and ther matters required settings. (If Eclipse project and there is “.project” file, by “Open Project”, you can import it by sepecifying the “.project” file. However, “Import Project” is more useful because you can specify the matters in detail. )

Setting “.gitignore”

If you want to manage the project in Git, you need to place “.gitignore” appropriate for your development environment. You can use gitignore/Android.gitignore at master · github/gitignore · GitHub. You can also refer to Log folder of Proguard and .gitignore on IntelliJ | DeVlog.

Open Project Folder

You can click the “Project” in the upper left to open the project folder.
From here you will be able to open the source files, such as.folder_compressed

Use SDK/AVD Manager

From the “Tools” menu, you can call “Android SDK Manager” or “AVD Manager”.

Run Application

From the “Run” menu, you can run the application.

Export Signed APK

To exprot signed APK, from the “Build” menu, click “Generate Signed APK …”.

Specify or create the path of keystore, password, and key alias.

I think you got a clue if you know above. At first, there may be a confusion. Please developing with reference also Getting Help .

[Reference Articles]

Log folder of Proguard and .gitignore on IntelliJ

In Android development, output folder of logs of Porguard is different between Eclipse and IntelliJ. In this article, I will explain the difference and managing of Git.

Proguard and Log Files

Proguard is a Java obfuscator and optimizer. You can use it by preparing a little on Eclipse or IntelliJ. Then, if you export a signed “.apk”, log files of proguard are output. In the log files, mapping ifnormation, etc. are recorded. You can use them on debug of the exported “.apk”.

In Eclipse, a folder named “proguard” is made under the project folder as below. Log files will be output in it.

On the other hands, in IntelliJ, the log folder is “proguard_logs”.

For now, we can not seem to specify the folder of our choice.(YouTRACK:Change Proguard logs output dir)

Git and Logs

To export “.apk” and to modify sources are not one-to-one correspondence. So you should not manage the logs in version control system. (You should save them on release.)

In Git, defining a file named “.gitignore”, you can exclude files to unmanage. You may get a template of “.gitignore” for android from GitHub:A collection of useful .gitignore templates, Android.gitignore. In current version, it support Eclipse and InttelliJ.

However, to support Proguard logs, the templates include definition for Eclipse, but not for IntelliJ. So you should add lines as below.

*2013/04/09 Supplement: Than before, I had to add this PullReques to github. From joeblau, I got a comment that my suggestions have been merged into templates generated by gitignore.io. (add Proguard folder generated by Intellij to Android.gitignore by junf · Pull Request #543 · github/gitignore)
gitignore.io is a service that will automatically generate “.gitignore” for your environment.

Pitfalls of how to remove the file from Git management

If you want to remove file “a” from currently Git management, you will do as follows.

And you may want to define “.gitignore”. This approach has been introduced in many places.

But in this case, when you checkout the past commit, you will see that the file “a” was overwritten by the previous contents. The file was supposed to be outside the control of Git.

You can reproduce the fact as follows.

By the last checkout, the contents of “a” will be rewritten to “initial”. In other words, even if “unmanaged” the file, the contents of the current file will be lost to be “managed” and go back to the past.

In this case, it is fatal in that because there is no history of changes of management outside, you can not retrieve the current file “a”.

I’ve also studied to try if you do not create “.gitignore”.

At the time you are trying to rewrite “a” with the last checkout, you will fail with an error. I think this is a desirable result. Git should remind you here, that unmanaged file “a” were managed at the past. If you moved file “a” somewhere once, you can checkout to get back “a” in the past.

Why the difference between the two situations happen this?

If there is “.gitignore”, the current file “a” has no interest to Git. Therefore Git would also be carried out without having to worry about checkingout to overwrite.
On the other hand, if there is no “.gitignre”, because “a” is “Untracked” file, Git does not checkout to overwrite it on its own.

Is this correct?

However, if there is no “.gitignore”, you are inconvenient to be displayed every time “Untracked”. Is not the only way to rm all “a” back in the past using rebase -i?
I am investigating whether there is any good way.