Ufkoku
Ufkoku

Reputation: 2638

Android Studio ignores module

I have application module, 4 android lib modules, and 2 java modules. I'm trying to add one more android lib module, but AS ignores it.

New module is created and added to settings.gradle. AS does not add *.iml file to module folder, and .idea/gradle.xml and ./idea/modules.xml files don't contain records about new module. I tried to generate *.iml file by myself, and added records to .idea/ files. It starts working, but then i got message

The modules below are not backed by Gradle anymore. Check those to be removed from the ide project too

, and *.iml file was removed.

AS 2.2.3, gradle 2.14.1

UPD 1.

The problem was in unexpected place. I tried this solution, because it was very similiar to my problem, tried to delete module and add it again (with new name). But nothing helped. After opening Gradle tab (right top corner), I found that new module was highlighted with dark grey color, right-clicked on it, and saw that "Ignore Gradle project" was checked by default.

Dropdown menu

I unchecked this item, but after next gradle sync I got above message, and this item was checked again automatically. Also in event log

Unsupported Modules Detected: Compilation is not supported for following modules: modulename. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

UPD 2. Seems like https://code.google.com/p/android/issues/detail?id=77983 and https://code.google.com/p/android/issues/detail?id=230550

Upvotes: 0

Views: 2242

Answers (2)

lushantingyue
lushantingyue

Reputation: 1

android {

   ...

    buildTypes {

        ...

        dexOptions {
            preDexLibraries true
        }
    }
}

Upvotes: 0

Ufkoku
Ufkoku

Reputation: 2638

The solution that helped me:

  1. Close AS
  2. Remove all *.iml files
  3. Remove .idea dir
  4. Remove .gradle dir
  5. Rename project
  6. Open project with AS

Upvotes: 4

Related Questions