I just had this issue in Android Studio. It seems Android Studio didn't realise my library project was a library despite the project.properties stating android.library=true.
I fixed this issue by checking the "Is Library" checkbox in Project Structure.