简体   繁体   中英

Gradle sync failed in android studio

I am using eclipse for developing android applications.Its works good and I can debug and run the application.But now I installed android studio and move to creating new apps using android studio,But i get the following error

Gradle sync failed

What is gradle and how can i fix this problem, Now also I can't import my eclipse project to android studio

I had the same issue when importing my project from eclipse to android studio. I'll tell you how I fixed it. It's simple.

- Solution 1: It is possible to import your project from eclipse to android studio, but android studio version 1.2 currently has bugs with that. What I did is I created a new application with the same app name, same package name, same minimum api and all these things... Then normally, go to your app's folder that you want to import it from eclipse, and copy it's src folder and java folder, maybe asset and libs folder too if you have them, and paste it to your newly created project in android studio by going to that folder: "Users/AndroidStudioProjects/appname/".

If that's not your issue, try the other following solutions:

- Solution 2: Add this to your gradle.properties file in the project. This will just increase your android studio's memory:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

You can also replace 512 to 1024 if you have enough memory in your pc.

- Solution 3: Try to close all your pc apps that consume large memory, and try that: In android studio, there is a toolbar at the top, where there is "Build" tab. Select Clean Project then Rebuild Project. Then try to sync your project again.

I would prefer to start solution 2 then 3 first before trying solution 1. If you still face the same issue, tell me. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM