Import of Eclipse project into Android Studio usin

2019-04-30 13:05发布

问题:

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.

回答1:

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.



回答2:

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"


回答3:

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!



回答4:

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-X.Y.Z/source.properties file under the Android Studio installation

e.g.

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"  

    ...

}


回答5:

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



回答6:

I also had the same problem then I have checked my Enviornment Variable and it is pointing to my old sdk which does not have Build tool 18.0.x After pointing it to new sdk everything goes well.