This is an annoying one. I have a simple project structure which is based on Gradle, very similar to other projects I have. The project has these imports:
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile files('libs/jackson-annotations-2.1.0.jar')
compile files('libs/jackson-core-2.1.0.jar')
compile files('libs/jackson-databind-2.1.0.jar')
compile files('libs/zip4j_1.3.1.jar')
compile files('libs/httpclient-4.1.3.jar')
compile files('libs/httpclient-cache-4.1.3.jar')
compile files('libs/httpcore-4.1.4.jar')
compile files('libs/httpmime-4.1.3.jar')
compile project(":grid_lib")
}
Which works well.
The only problem is that the Android Studio does not recognize those classes, so they are all in red and have no intel. Very annoying!
I've been banging my head against the wall for too long, so I'm trying here now. What do you say guys? Any ideas?
Thanks :-)
Edit
I've answered my own questions, for those who find the same problem.
well, to answer my own question...
Sometimes Android Studio's Gradle goes haywire, and I found a simple fix:
For other gradle problems, an additional step may be required, which is copying the gradle wrapper (gradlew files, and gradle folder, not the .gradle folder) from the newly created project to your own project, and re-import your project.
You can now delete the new project... of course.
Gradle's version keep changing. If you are still having trouble, try this-
Edit your gradle/wrapper/gradle-wrapper.properties file, and update the distribution url's version. Currently it should be 1.8, but it may change in the future. So you can use a "new project" to find out what the version should be. Example: distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
Edit your build.gradle file, and change the minimum version to 0.6.+ - and again it may change in the future. Example for current versions: classpath 'com.android.tools.build:gradle:0.6.+'
Restart your Android Studio and recompile.
I encountered the same problem once I tried to upgrade Crashlytics to Fabric which cost me few hours to solve it. I tried cleaning the project and rebuilding it from IDE and Terminal, closed Android Studio and opened it again, synced the gradle, checked out to other git branches and so on. Non of them solved the problem! As a final attempt I closed the project and imported it to Android Studio again and the error was gone!!! I couldn't find any explanation for why it happened but it could be some sort of caching issue on the gradle which was not being cleared in normal ways.
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