10

I have an Android project in IntelliJ IDEA. It consists of two modules: app and library. App depends on library and library depends on app (Yes, it's not good, but I have what I have and can't change this). IDEA in project settings warn me about circular dependencies, but project builds correctly. Project structure looks like this:

project
|__app
|    |__src
|    |__build.gradle
|__libarary
|    |__src
|    |__build.gradle
|__build.gradle
|__settings.gradle

Now I'm trying to migrate to new Android build system based on Gradle and have a trouble here. In my build.gradle from app module I add dependency on library

compile project(":library")

Also I tryed to add dependency in library on app like

compile project(":app")

But gets error from build system, when gradle trys to assemble library module:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > Module version project:app:unspecified depends on libraries but is not a library itself

What I can do with this without changing project structure

Mike Ortiz
  • 4,031
  • 4
  • 27
  • 54
Dmitriy Tarasov
  • 1,949
  • 20
  • 37

3 Answers3

1

This parameters have changed.

You should now refactor:

In the library project use:

apply plugin: 'com.android.library'

In the app project use:

apply plugin: 'com.android.application'

Lucas
  • 43
  • 6
0

In the library project use:

apply plugin: 'android-library'

In the app project use:

apply plugin: 'android'

Make sure you have the newest Android tools:

classpath 'com.android.tools.build:gradle:0.5.+'

Jan Weitz
  • 444
  • 4
  • 11
0

If you arrive here searching for the same error with Android 3.0 you should know the current workaround is:

downgrade to kotlinVersion = '1.1.2-2'

and disable incremental build in gradle.properties kotlin.incremental=false

The issue is planned for the next alpha https://issuetracker.google.com/issues/38447344

Calin
  • 6,661
  • 7
  • 49
  • 80