Cordova gradle wrapper missing in android sdk

2019-03-18 13:47发布

I'm on windows7 x64, installed today's latest stable release of android sdk studio (through android studio bundle, since it's shipped together now apparently). I have properly configured the environment variables as you'll see above.

This is what I get when issuing the following command

$ cordova build android

ANDROID_HOME=G:\installs\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: G:\installs\Android\sdk\tools\templates\gradle\wrapper

And indeed, the "templates" directory doesn't even exist in my sdk install.

I've already tried the suggestions (setting the right path, uninstall/reinstall) of this question here but nothing applies to my case, and I find that manually copying and pasting packages is not really a solution, since there's a package manager in place.

If anybody has an answer as of today's android install, would be very much appreciated.

4条回答
女痞
2楼-- · 2019-03-18 14:09

I downloaded Android SDK r25 manually and placed templates folder inside Android/sdk/tools. This solved the issue for me. You can get it from https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip

For Windows:

https://developer.android.com/studio/index.html

Go to the section :"Get just the command line tools"

There is a link 'sdk-tools-darwin-3859397.zip' for Mac, Unfortunately that didn't have the templates folder with Gradle Wrapper. So for Mac users, i will suggest not to go for this zip.

查看更多
Lonely孤独者°
3楼-- · 2019-03-18 14:31

When you develop apps with Cordova and Microsoft Visual Studio there are some important facts you should know. I learned these things over 2.5 years of period.

  1. Visual Studio tools for apache cordova is Microsoft product and it's not updated alongside with other tools using by app developers.

Android SDK - Updating Regularly X-Code - Updating Regularly ( I would recommend not to use windows based tools to publish your app to apple store. please follow this to learn how to publish your app to apple store without using remote debugging tools. https://guntucomputerhacks.blogspot.com/2016/11/visual-studio-2015-cordova-remotebuild.html ) Cordova and Plugins - There is a big version gap between microsoft tools for Cordova.

So lets focus on this graddle issue. The latest android version released in 2018 is android 8.0 and 8.1 Oreo . But unfortunately microsoft tools for apache cordova is still supporting Android 7.1 - Nougat.

So in case you have updated your android SDK and tools you might need to rollback that update to use Microsoft tools to build and release your app to Google Play.

But again try to keep Visual Studio for development tasks and always try to native tool set for release purposes.

Please visit my blog for more apache cordova tips.

https://guntucomputerhacks.blogspot.com

查看更多
forever°为你锁心
4楼-- · 2019-03-18 14:32

If still not working then copy all file from gradle\wrapper from Android Studio installation folder

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

and paste it in your Android SDK gradle\wrapper then run same command.

E:\android-sdk\tools\templates\gradle\wrapper

查看更多
够拽才男人
5楼-- · 2019-03-18 14:34

This is a known issue; see CB-12544. For now you'll need to downgrade.

查看更多
登录 后发表回答