error: could not find gradle wrapper within android sdk. might need to update your android sdk

匿名 (未验证) 提交于 2019-12-03 03:03:02

问题:

http://i60.tinypic.com/51v880.jpg

build-tools is: android-5.1

platform-tools updated

my platforms are
android-5.1
android-17

回答1:

If you have Android Studio installed, try to copy the templates directory of Android Studio

C:\Program Files\Android\Android Studio\plugins\android\lib\templates

to your android sdk tools directory:

C:\Android\sdk\tools

This did the trick for me :)



回答2:

Update ANDROID_HOME path from

C:/Users/CURRENT_USER/android-sdk/tools/ 

to

C:/Users/CURRENT_USER/android-sdk

This should solve the problem When you build it appends tool automatically to your ANDROID_HOME therefore it searches for graddle inside tools/tools directory which is not present at all.



回答3:

I had a similar problem with Android Studio running on a Mac.

I fixed it with the following commands:

cp -r /Applications/Android\ Studio.app/Contents/plugins/android/lib/templates ~/Library/Android/sdk/tools chmod a+x ~/Library/Android/sdk/tools/templates/gradle/wrapper/gradlew


回答4:

I was having same error: could not find gradle wrapper within android sdk; When I was building ionic, but I solved it. I just downloaded Android SDK tools package and copied extracted file to C:\Users\CURRENT_USER\AppData\Local\Android\sdk and then issued: build ionic/cordova again.

it worked for me.



回答5:

Got the same error in mac after updating the SDK Build Tools:

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.    Looked here: /Users/xxx/Library/Android/sdk/tools/templates/gradle/wrapper

Here is the method how I solved it:

  1. Copied templates folder from /Applications/Android Studio.app/Contents/plugins/android/lib to /tools
  2. chmod -R 777

Good luck!



回答6:

Have you checked the path manually ? (C:/Users/Arsan/android-sdk/sdk/tools/...)

I had to update my ANDROID_HOME path for this to work (to android-sdk/tools, so removing "sdk" from the path).

Steven



回答7:

update android project to cordova-android 6.2.1

cordova platform update android@6.2.1

for more details check the following links https://cordova.apache.org/announcements/2017/04/05/android-release.html



回答8:

I had same issue... (2016-09-26, installed current version of Android SDK today)

ANALYSIS

I checked the installation and found out that the gradle wrapper is placed at a wrong location: ...\Android\SDK\tools\templates\gradle\wrapper\gradle\wrapper/[here_are_the_files]

Hence there is gradle/wrapper/gradle/wrapper in the end....

That folder conatins:

  • gradle-wrapper.jar
  • gradle-wrapper.properties

SOLUTION

Moving the content of that folder to the ...gradle/wrapper/-folder (hence 2 folders UPWARDS) solved my problem.

Hope that helps



回答9:

I have same issue: could not find gradle wrapper within android sdk when i build ionic, but i was solve. I just download Android SDK tools package361 and copy extract file to C:\Users\CURRENT_USER\AppData\Local\Android\sdk and build ionic/cordova again. Download link https://dl.google.com/android/repository/tools_r25.2.3-windows.zip



回答10:

None of the solutions worked for me as of today. My situation was that I got my Android studio updated. The most popular thing to replace the tools folder with the latest one wouldn't work for me. Infact is not required in some cases.

npm update -g cordova did the trick for me.

Then I removed the platform and added it again.

ionic platform remove android

ionic platform add android

This works for me in Ionic. I am sure cordova platform remove/add android will do the same stuff. Not tested though.

Working again !



回答11:

set ANDROID_HOME in system variable as follows

C:\Program Files\Android\android-sdk

And set path in user variale as follows

appropriate jdkpath ; C:\Program Files\Android\android-sdk\tools;C:\Program Files\Android\android-sdk\platform-tools


回答12:

If you reinstalled Android Studio, there may be an sdk1 and also sdk folder in this path:

C:\Users\CURRENT_USER\AppData\Local\Android\

If you have two sdk folders you will have to delete one of them. Keep the one that contains the AVD Manager.exe and SDK Manager.exe.

This worked for me.



回答13:

In my case, some error occured during the Android Studio installation, and the tools/templates directory didn't exist. I fixed it by uninstalling and then reinstalling the Android SDK Tools, in the Android Studio Package Manager.



回答14:

for my case: i figured out that templates folder is no longer available in the new sdk tools folder so:



回答15:

Check whether your Android SDK having gradle/wrapper folder and having required files in that or not.If not update the Android SDK and try once.Make sure that you need set SDK root path in ANDROID_HOME in Environment variable in windows machines.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!