I'm having a problem when Android Studio v0.3.5 where the symbol 'Inject' isn't recognized.
I have the following: import javax.inject.Inject;
where the whole line is greyed out except for Inject where it's red. The greyed out part gives me a hint that it's an unsused import, but the red part gives me a cannot resolve symbol error.
So I followed the instruction here-> Android Studio: Add jar as library? , but without any success. I get the following error when I do a gradlew clean
.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\dovailla\AndroidStudioProjects\BootstrapProject\build.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'BootstrapProject'.
> Could not find method compile() for arguments [file collection] on root project 'BootstrapProject'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.093 secs
Anyone have a clue?
javax.inject isn't part of the Android Java library, so you'll need to pull that in from an external library. You might find some more help at Android Roboguice Exception
Note that the answers there tend to have you download a jar, put it in your libs directory, and access it that way; you may find it more convenient to use a Maven-style dependency declaration, similar to:
dependencies {
...
compile 'javax.inject:javax.inject:1@jar'
}
Looking at the error message from your build, I think it's a syntax error in your build.gradle file -- did you put your compile files(...)
statement in your dependencies
block?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With