Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NonExistentClass #435

Closed
ppamorim opened this issue Aug 10, 2016 · 11 comments

Comments

Projects
None yet
8 participants
@ppamorim
Copy link

commented Aug 10, 2016

Sometimes the compiler don't know what wrong happens with the compile and return this blind error. I'm using Kotlin with the last stable version (1.0.3-release-IJ134-105). I feel a little bit lost when this error happens. I really don't know if it's problem with Dagger or Kotlin. Btw, can you help me?

screen shot 2016-08-10 at 11 15 37

(This error was triggered with a unknown error with the name of the class, strange...)

@ronshapiro

This comment has been minimized.

Copy link

commented Aug 10, 2016

What made you think of Dagger when you saw this? I don't see anything related to it in that error trace. Probably makes sense to post it to Jetbrains's or Gradle's issue trackers

@ppamorim

This comment has been minimized.

Copy link
Author

commented Aug 11, 2016

This error happens with the Dagger's generated code, using kapt. If the code has some problem with the structure of the DI, the compiler gives me this error. It should be something more complete I think...

@jonatbergn

This comment has been minimized.

Copy link

commented Aug 11, 2016

What happens when you try to manually build with ./gradlew clean?

@cvoronin

This comment has been minimized.

Copy link

commented Aug 11, 2016

I can reproduce such a message when I add an incorrect method in component's interface and try to Make a project

For example

fun inject(activity : MissingActivity) <<< Missing Activity

or

@Missing fun inject(activity: MainActivity) <<< Missing annotaion

In such cases I see a message in Gradle Console/Messages tab

error: cannot access NonExistentClass
class file for error.NonExistentClass not found
Consult the following stack trace for details.

@ronshapiro

This comment has been minimized.

Copy link

commented Aug 11, 2016

I still don't see anything related to dagger... What if you remove dagger from kapt? Do you still get a similar error? what if you use another annotation processor, like @AutoValue but not dagger?

@cvoronin

This comment has been minimized.

Copy link

commented Aug 11, 2016

I think it is only kapt-related issue, not dagger-related.

@tbroyer

This comment has been minimized.

Copy link

commented Aug 12, 2016

@ronshapiro ronshapiro closed this Aug 12, 2016

@ronshapiro ronshapiro reopened this Oct 7, 2016

@ronshapiro ronshapiro closed this Oct 7, 2016

@Yazon2006

This comment has been minimized.

Copy link

commented Dec 11, 2017

For those who want to find the error in his/her own code:

  1. Comment the line kapt "com.google.dagger:dagger-compiler:$daggerVersion"
  2. Run compile with --stacktrace --debug
  3. See real error in log.
@starkej2

This comment has been minimized.

Copy link

commented Dec 12, 2017

You can also just run ./gradlew :app:compileDebugJavaWithJavac --stacktrace to find the source of the error

@zzhifu

This comment has been minimized.

Copy link

commented Nov 26, 2018

Some annotation processors (such as AutoFactory) rely on precise types in declaration signatures. By default, Kapt replaces every unknown type (including types for the generated classes) to NonExistentClass, but you can change this behavior. Add the additional flag to the build.gradle file to enable error type inferring in stubs:

kapt {
    correctErrorTypes = true
}
@tbroyer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.