I want to compare two projects in Android studio - android-studio

I have a couple Android Studio projects that are similar, and I want to know exactly where their source files differ. What is an easy way to do that?

Right click file/directory/project/module > click compare with > give the path to compare
EASY WAY TO FIND PATH : ( considering both projects are open in Android Studio)
Switch to project you want to compare > right click file/directory/project/module > copy path > paste it back in select path dialog.
BETTER to copy path first.
Verified : Android Studio 1.5.1

In Android studio 3.4.2 you can do by right click on
Select Android : app → Compare Directories select proper path for your files and done.
In Android Studio Bumblebee : app → Compare With or Ctrl+D :)

I'm highly recommend Compare Directories Plugin for Android Studio 2+.
Allows the fast comparison of two directories or archive files (jar,
zip, war... and also tar/gz) based on file contents. Compared
directories/archives are shown in a tree view to give a better and
easier-to-read overall view of the differences.
Installation:
Open: File > Settings > Plugins
Click on the button “Browse repositories”, find the “Compare Directories” plugin in the available plugins list, right click on it and choose install.
General usage instructions:
Execute the Compare Directories... menu command, select two directories or zip/jar/tar files containing files with the same file names and see the comparison results on the opened Compare Directories panel:
Files and directories are shown depending on the differences in their
contents: identical, different by blanks only, non-significantly
different, different, left-only, right-only.
Compared text file can be then edited within IDEA.
Compared text file differences can be then viewed with the usual IDEA diff window.
Compared class bytecode differences can be also viewed with the usual IDEA diff window.
Files and directories can be copied from one side to the other.
You will find many more details in the plugin page:
https://plugins.jetbrains.com/plugin/113-compare-directories

Related

How to quickly find files in big Android Studio Project

I want to know that how can I find the files (java files, Kotlin files, xml files) in a big Android Project having hundred of files.
Like since yesterday I am trying to find a Kotlin file inside my project which is associated with a xml file. I was somehow able to find the xml file but now I don't know in which Kotlin file this xml is used.
It consumes a lot of time to search for files when you are working on a big project which is built by other people so is there any way I can easily navigate files in Android Studio.
Please let me know it will be very helpful and will save lot of my time!
If you know the file name then do Double shift and then write the name of the file.
Or if you have found the xml file then do write click on the xml file in the project structure and then click find Usages menu or shortcut is Alt+F7
Menu : Edit -> Find -> Find to open find a search box or On a Windows or Linux based machine use shortcut Ctrl + Shift + F to search any string in whole project. ...
On OSX use the Command key instead of Ctrl .
Use Ctrl + F combination for Windows and Linux to search in current file.
Secon

How to hide generated dart files in Android Studio

Is it possible to hide generated dart files in Android Studio especially *.g.dart files?
In Project panel, under Options there is a File Nesting Option. I added .chopper.dart; .freezed.dart; .g.dart to .dart parent. This will group related files under the main file.
In Settings panel, open Editor section, and select File Types. Now look for Ignore files and folders field at the bottom. Just include *.g.dart there and you're good to go!

Is there a way in Android Studio to see all local changes in a single diff window?

With other editors I used it was possible to see all local changes in a single diff window showing the unified diffs off all files one after the other, so if I changed 3 files for example then I could simply scroll through the changes in a single window without having to select the files separately for diffs.
Here's an example of what I mean from magit which shows all changes in a single window:
Is there a way to do this is Android studio?
Right-click on your project in project structure on the left.
then Local History -> Show History. If you want to show history only for src folder, click on it.. the same for layout folder etc..
It will open in one separate window and shows diff between changed and file before changes.
Try Version Control on the bottom left of Android Studio:
It lets you choose between the unified viewer and a side-by-side view:

Stop android studio grouping single-item directories with a dot

If I have a directory which only (at present!) contains another directory Android Studio decides, for some strange reason, to not expand the directories in the usual manor - ie click folder1 to reveal folder2, then click folder2 to show its contents - but instead put them together in a single entry (folder1.folder2). This makes the directory structure incredibly difficult and inconsistent to deal with when trying to manipulate the contents. Right now I'm having to revert to doing so in windows explorer!
Is the any way to change this peculiar behavior.
Click the settings icon in the Project view and uncheck Compact Empty Middle Packages.
Note: this screenshot is from IntelliJ Ultimate, but it should look the same (or similar) in Android Studio.
I got it to work similarly by going to the Project View settings and then unchecking the Flatten Packages option. This then got my folder configuration to the desired subfolder configuration format as described above. This may be new compared to the answer of 5 years ago. In my case, only unchecking the Compact Empty Middle option was not enough.
Use combination of Ctrl+Shift+A inside Android studio, it's a shortcut for "Find Action..." and type in "package", there is "Compact Middle Packages", turn that off.

Find in Entire Solution in Visual Studio 2012 gets quite a lot of result from Temp folder

In Visual Studio 2012, I tried to do some search in:
Find in Files->Entire Solution, then I get quite a lot results from files in
C:\Uses\myusername\AppData\Local\Temp\
. The files take the name like tmpE11.tmp.cs or tmpFBEE.tmp.cpp, the contents are identical to some of the files in my solution.
My guess is that it is caused or auto-generated by some crashes, but why are they reachable by the search? I doubt if I can simply delete them or not.
Maybe this is related to a bug reported, where lots of tmp files created and are then included in the Find Results. If I clear the 'Miscellaneous Files Folder' the search does not include the temporary files.
To display the 'Miscellaneous Files Folder' (see https://msdn.microsoft.com/en-us/library/36bhtx7w.aspx):
List item
On the Tools menu, click Options.
In the Options dialog box, expand the Environment node and select Documents.
Select Show miscellaneous files in Solution Explorer.
Specify the number of documents you want to appear in the folder.
In Visual Studio 2013 you can limit the contents to 0 which effectively prevent inclusion.

Resources