p__b
p__b

Reputation: 133

can't sync gradle from android studio, but works from console

I have problem building syncing gradle files with project in android studio. I have multi project solution. I use 'com.android.tools.build:gradle:1.0.1', and gradle wrapper version 2.2.1 When I click sync button it say's:

Gradle 'gitrepo' project refresh failed

Error:exception during working with external system:

call stack from idea.log: http://pastebin.com/WDh6FUc4

I've tried cleaning project, invalidate cache, restart computer, remove .gradle folder.

I've also found out that when I run gradlew and gradlew build it works normally, so I assume that build.gradle files are OK.

Thanks for help!

Upvotes: 3

Views: 8486

Answers (4)

Marian Klühspies
Marian Klühspies

Reputation: 17667

For me File -> Invalidate Cache / Restart did the job

Upvotes: 0

Joe
Joe

Reputation: 81

I faced the same problem because I had set up ndk dir in my local.settings as:

ndk.dir=/home/tm/Android/Sdk/ndk-bundle

Make sure you have the ndk-bundle in your location, or update your local.settings by removing the ndk.dir location.

It works fine for me after doing that.

Upvotes: 6

Diederik
Diederik

Reputation: 6498

My AndroidManifest.xml file was broken, and caused the same issue. Seems Android Studio doesn't like being in that state. Fixing the file solved it for me.

Upvotes: 1

p__b
p__b

Reputation: 133

Self answering but maybe it will help someone else.

My build.gradle didn't have

versionCode 1
versionName "1"   

in defaultConfig section. Gradle itself didn't crash at it but Android Studio had problems there.

Upvotes: 8

Related Questions