1

After upgrading to Android Studio 1.5 - inspections.sh stopped running with the following message.

/Applications/Android\ Studio.app/Contents/bin/inspect.sh /Users/cosminstirbu/MyApp  /Users/cosminstirbu/MyApp/inspections_profile.xml /Users/cosminstirbu/MyApp/inspectionsresults -v2 -d /Users/cosminstirbu/MyApp/app
2016-01-06 14:46:20.696 studio[6443:163537] Value of STUDIO_JDK: (null)
2016-01-06 14:46:20.706 studio[6443:163547] fullFileName is: /Applications/Android Studio.app/Contents/bin/studio.vmoptions
2016-01-06 14:46:20.706 studio[6443:163547] fullFileName exists: /Applications/Android Studio.app/Contents/bin/studio.vmoptions
2016-01-06 14:46:20.707 studio[6443:163547] Value of STUDIO_VM_OPTIONS is (null)
2016-01-06 14:46:20.707 studio[6443:163547] Processing VMOptions file at /Applications/Android Studio.app/Contents/bin/studio.vmoptions
2016-01-06 14:46:20.707 studio[6443:163547] Done
2016-01-06 14:46:20.707 studio[6443:163547] Processing VMOptions file at /Users/cosminstirbu/Library/Preferences/AndroidStudio1.5/studio.vmoptions
2016-01-06 14:46:20.707 studio[6443:163547] No content found
2016-01-06 14:46:20.708 studio[6443:163547] Processing VMOptions file at 
2016-01-06 14:46:20.708 studio[6443:163547] No content found
/Applications/Android Studio.app/Contents/bin/idea.properties: 'java.endorsed.dirs' already defined
Jan  6 14:46:26 users-MacBook-Pro.local studio[6443] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan  6 14:46:26 users-MacBook-Pro.local studio[6443] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan  6 14:46:26 users-MacBook-Pro.local studio[6443] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan  6 14:46:26 users-MacBook-Pro.local studio[6443] <Warning>: Invalid Connection ID 0
Starting up Android Studio 1.5.1 ...done.
Opening project...done.
Initializing project...Loaded profile 'MyApp' from file '/Users/cosminstirbu/MyApp/inspections_profile.xml'
done.
Inspecting with profile 'MyApp'
This project contains no modules. Inspection cannot proceed.

Below you can find the .gitignore file

# Built application files
build

# Crashlytics configuations
com_crashlytics_export_strings.xml

# Local configuration file (sdk path, etc)
local.properties

# Gradle generated files
.gradle/

# Signing files
.signing/

# User-specific configurations
.idea/libraries/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
*.iml

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

So it says that the project does not contain any modules.

My guess is it happens because of some ignored files, because after I open the project with Android Studio and then run inspections, it works.

In https://www.jetbrains.com/ruby/help/running-inspections-offline.html it doesn't say anything about which files should be committed or not. And I definitely don't want to commit the workspace.xml and the .iml files.

Cosmin
  • 2,840
  • 5
  • 32
  • 50

1 Answers1

1

The inspections require an IntelliJ IDEA project to work. At a minimum, you need the .iml files, .idea/modules.xml and everything under .idea/libraries. Contrary to what the comment in your .gitignore file says, none of these files contains user-specific configurations, and all of those files are designed to be checked in to the VCS and shared with other users.

(You don't need to check in *.iml and the other files if you're using Gradle, because they can be generated when you open build.gradle in the IDE, but the offline inspections do not support build.gradle import, and require the actual project and module files to be present.)

You don't need the workspace.xml file, which does in fact contain your user-specific configuration.

yole
  • 92,896
  • 20
  • 260
  • 197
  • Unfortunately the .iml is user specific as well. For instance if I select a different flavor on my local machine, the .iml will appear as modified in my local git repository. What we have ended up doing is commit the .iml, misc.xml, modules.xml and inspections profile. After we commited them we have added the to .gitignore and we had to run locally skip-worktree in order to really ignore them. Please see http://stackoverflow.com/questions/13630849/git-difference-between-assume-unchanged-and-skip-worktree – Cosmin Jan 08 '16 at 08:05