问题
When moving to a new computer I have lost a drive and now am using a different file path for my programming assets.
When I start up one of my previous working projects in Android Studio I run into an issue with Gradle.
It reads as follows. Gradle 'Timer' project refresh failed: Can't resolve Gradle project. Reason: given path (E:\Media\Documents\Dropbox\Programming\Android\AndroidStudioProjects\Timer\build.gradle) doesn't point to a file
My new gradle path is 'C:\Programs\gradle\gradle-1.6' and when I go to Gradle settings in my project it says that it detects this, however after hitting 'ok' and saving/reloading the project the same error persists.
I have GRADLE_HOME set in the environmental variables. Other projects that are built on this system work however do give this following error "Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'."
Am I missing a configuration step somewhere?
Thanks
回答1:
I just ran into this problem when moving to a new computer.
What I did was choose to import a project (using build.gradle as import file) rather than open a project. When prompted about gradle information I didn't supply a gradle home but selected to use the gradle wrapper.
回答2:
Thanks for your suggestion oceansize42, but actually that didn't help me fix my problem as it reoccurred after I restarted Android Studio.
After some more searching,I found two files with references back to my old drive.
.idea\workspace.xml and .idea\gradle.xml
workspace.xml contained an option "KEY_STORE_PATH" that had an old path. gradle.xml contained my issue "externalProjectPath" that was giving me the error.
Changing both of these and then restarting fixed my issue completely.
来源:https://stackoverflow.com/questions/17102038/android-studio-cant-resolve-gradle-project