简体   繁体   中英

Import of Eclipse project into Android Studio using build.gradle file fails

I'm trying to import my Eclipse based Android project using the build.gradle file. I get the following message: "failed to find Build Tools revision 18.0.0". However, according to the Android SDK Manager, I have Android SDK Build-tools 18.0.1 installed.

I am doing all this on a 64-bit Windows 7 machine, if that's relevant.

How do I fix this?

UPDATE: I actually only updated to Build-tools 18.0.1 this morning. I then noticed that, when making a new project in Android Studio, it wouldn't allow me to create a project using Android 4.3 (4.2.2 was the latest allowable version). I tried dropping the target version of my project to Android 4.2.2, and re-exporting it. Now Android Studio complains about not being able to find Build-tools 18.0.1 when I try to import this project.

I was an Android Studio virgin too up until 10 minutes ago. I ran into the same problem. If you check your SDK Manager in Android Studio (or Eclipse I believe) it will show which tools you have installed. I am/was missing build tools 18.0.1 too and getting the error....but it was because I hadn't installed them.

So without modifying the Gradle build files , I was able to install the build tools using the SDK Manager and get everything up and running.

See this image: 在此输入图像描述

As an aside, I also had to update the API version as well because it selected an API version that wasn't installed (which I don't get because it was when I compiled with Eclipse).

Hope this helps.

This did the trick for me.

In build.gradle file inside the main module modify the line

buildToolsVersion "18.0.0" 

to

buildToolsVersion "18.0.1"

I'm very new to Android Studio (as of last night). I encountered the same problem. I opened up the 'build.gradle' file and modified the lines with: "compileSdkVersion 18" and "buildToolsVersion 18.0.1" to 17 and 17.0.0 respectively. It seems to do the trick!

you must make sure the build.gradle file contains the same version of the installed build tools.

you can find this out by looking in the /sdk/build-tools/android-XYZ/source.properties file under the Android Studio installation

eg

Pkg.UserSrc=false
Pkg.Revision=18.1.1

then plug that revision number into the gradle build file:

android {  
      compileSdkVersion 18  
     buildToolsVersion "18.1.1"  

    ...

}

I had issues with Gradle too. A full delete and install the latest version fixed it.

我也有同样的问题,然后我检查了我的环境变量 ,它指向我的旧sdk没有Build工具18.0.x指向新sdk之后一切顺利。

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