0

I have two projects that use the Calligraphy Library for custom fonts in Android. I added the Calligraphy aar dependency / module to the project the exact same way in both projects except that one project can see the namespace and the other can't..

import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; finds it in one project and not in the other..

Both of them I created a "new module" and selected an existing AAR to base it off. Then added through the gui the dependency, which does the same as manually throwing: compile project(':calligraphy-2.0.2') into the main project's build.gradle file and , ':calligraphy-2.0.2' into the projects settings.gradle file.

  • import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; works in the first, fails in the second...
  • import uk.co.chrisjenx.calligraphy.R; however, works in the second.. but doesn't allow me to use CalligraphyContextWrapper..

1 Answer 1

1

The aforementioned method works. The bug appears to be in the IDE (Android Studio).. it says it can't find the imported library, but come compile and execution time, it works as expected. What the!?

enter image description here

Why is this, does anyone know? It clearly can't find the library until build time, then it locates it fine..

Sign up to request clarification or add additional context in comments.

1 Comment

The difference is simple: The dependency is visible to gradle - that's why it compiles fine - but not to Android Studios on the fly syntax checker. Android Studios on the fly syntax checker thinks that the library does not exist when in fact gradle can find the library just fine. Expect a fix for this in future releases. In most cases such errors are triggered when you are messing around with experimental features or try to do something that is on the fringes of what Android Studio supports (for example compiling Java 8 projects - it works, but the syntax checker may go temporarily insane)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.