Question

I've read a lot of questions & answers in SO, without any luck. Example: Module packages not found at compile time in IntelliJ

The thing is that I've a project which formed by:

  • Module A
  • Module B
  • Module C

Module B has a dependency with module A and module C.

So the imports in module B, to code are like

import com.moduleA.Fragment1;
import com.moduleA.Fragment2;
import com.moduleA.SomeInterface;

Those lines are correctly imported in "coding-time", I can work with those classes correctly.

However when I do compile, it crashes with a:

Error:(8, 32) error: com.moduleA does not exist

I've tried adding this module A as Android Library but it's not OK for me, because Android requires generating constants fields (http://tools.android.com/tips/non-constant-fields).

I don't know what else to do.

Any tips?

Était-ce utile?

La solution

Sorry for the people who asked for an example of code, but it was as basic as that, with a Gradle build.

I fixed the issue by creating a library project within my project. So module A is actually a Library.

I said that I couldn't use library because of the non-constant-field, but that error was generated by AndroidAnnotations, which explains how to create library modules with it:

https://github.com/excilys/androidannotations/wiki/Library-projects#referencing-ids-by-name

Thanks.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top