I am using the volley library to perform network operation in android. So I am trying to add this library in my project which is created in Android Studio and gradle system
To diagnose this error quickly drop to a terminal or use the terminal built into Android Studio (accessible on in bottom status bar). Change to the main directory for your PROJECT (where settings.gradle
is located).
1.) Check to make sure your settings.gradle
includes the subproject. Something like this. This ensures your multi-project build knows about your library sub-project.
include ':apps:App1', ':apps:App2', ':library:Lib1'
Where the text between the colons are sub-directories.
2.) Run the following gradle command just see if Gradle can give you a list of tasks for the library. Use the same qualifier in the settings.gradle
definition. This will uncover issues with the Library build script in isolation.
./gradlew :library:Lib1:tasks --info
3.) Make sure the output from the last step listed an "assembleDefault" task. If it didn't make sure the Library is including the Android Library plugin in build.gradle
. Like this at the very top.
apply plugin: 'com.android.library'
I know the original poster's question was answered but I believe the answer has evolved over the past year and I think there are multiple reasons for the error. I think this resolution flow should assist those who run into the various issues.