Gradle dependencies not being included on Android

I’ve got what is a pretty simple gradle file in my application module, which was generated automatically by Android studio.

When I go to launch my app, I get:

E/AndroidRuntime( 1828): java.lang.NoClassDefFoundError: com.google.common.collect.Lists

Android studio is apparently reading the dependencies correctly, since Lists successfully imports there - it’s like it’s just not being included in the APK for some reason.

runtime is a superset of compile, by default, according to the docs, so I’m not really sure where to go from here. What’s the approach to debugging this?

The gradle file in question:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'
  repositories {
    mavenCentral()
}
  dependencies {
    compile group: 'com.google.guava', name: 'guava', version: '14.+'
    compile group: 'com.squareup.dagger', name: 'dagger', version: '1.+'
    compile files('libs/android-support-v4.jar')
}
  android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"
      defaultConfig {
        minSdkVersion 10
        targetSdkVersion 17
    }
}

using gradle 1.6.

I tried building from the command line, got the same result. The confusing part is that something of this must be valid, since Android Studio is parsing it all correctly and is able to compile successfully.

Moving the actual jars into the project didn’t help either.

Also tried turning proguard off, just in case.

the gradle commands didn’t work for me

This fixed my issue, thank you so much!

Dude. THANKS. I was pulling my hair out…just happened to try this.

This seems to be a bug. Shouldn’t be that gradle don’t package your libs dependencies unless you clean your project.

Have you reported this to the Google folks? This is a bug that they will need to fix.

Swear word.

gradle clean -> gradle assemble --info fixed this.

No idea what went wrong, but it was crazy frustrating. At least I learned the gradle command line commands.