square / dagger

A fast dependency injector for Android and Java.
https://square.github.io/dagger/
Apache License 2.0
7.31k stars 3.06k forks source link

Getting java.lang.NoClassDefFoundError if package name is different than applicationId #493

Closed gabrielsoroush closed 9 years ago

gabrielsoroush commented 9 years ago

I just created a new flavor in my gradle file with a new applicationId, but my app crashes when I'm trying to inject a class. It throws this exception:

java.lang.NoClassDefFoundError

It seems that it's still looking at the default applicationId and package name. I only see this issue on Kitkat and below. Please let me know if you need more information about this issue.

JakeWharton commented 9 years ago

We need a lot more information as you've given almost none. Dagger doesn't care what your application ID or package name is—it knows nothing about Android. You need to provide a full stack trace, show your graph creation and module code, and/or create a sample that demonstrates the problem.

On Mon, Aug 17, 2015, 7:07 PM Soroush notifications@github.com wrote:

I just created a new flavor in my gradle file with a new applicationId, but my app crashes when I'm trying to inject a class. It throws this exception:

java.lang.NoClassDefFoundError

It seems that it's still looking at the default applicationId and package name. Please let me know if you need more information about this issue.

— Reply to this email directly or view it on GitHub https://github.com/square/dagger/issues/493.

gabrielsoroush commented 9 years ago

Thanks Jake for your quick response. Unfortunately I can't share any code here. But after reading this: https://code.google.com/p/android/issues/detail?id=75456 I figured it might be the gradle issue not Dagger.

JakeWharton commented 9 years ago

Ok. Without more info there's no action for us to take then.