• Register
0 votes
135 views

Problem :

I am working on the Ionic project in Ubuntu 16.04 LTS, and now I am preparing for release. So I am running the following command:

cordova build --release android

But I am facing the following error:

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

Looked here: /home/user/Android/Sdk/tools/templates/gradle/wrapper

·   I am not having the templates/gradle/wrapper directory.

·   I am having the latest version of Android Studio is 2.3 for now

·   I am having Android SDK Platform-Tools 25.0.3

·   I am having Android SDK Tools 25.3.1

·   I am having  All Android versions from 2.1 (Eclair) to 7.1.1 (Nougat)

Does anybody have any clue on this error?

6 5 3
7,540 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution:

1.  If you are having the android studio installed within your system then you just need to copy the templates folder from following path :

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

2.  After that you need to Paste it in the following folder

C:\Users\<user-name>\AppData\Local\Android\sdk\tools 

3. Now you need to Run the command following command:

ionic build android

 It will download all the necessary jar files and will also generate the apk file for the application.

Please set your environment variables to C:\Users\<user-name>\AppData\Local\Android\sdk\tools. And also set user-name to your current username.

9 7 4
38,600 points
0 votes

It can be an obstruction in the instruction list of how to install or upgrade Andriod studio will all SDK tools which you have missed. This creates a bug by a new release of the studio which does not follow the same file conventions as the older version allows. Since many posts on this topic seem to point to an Andriod_Path folder with a folder called andriod_sdk which does not seems to be supported in the latest versions

Solutions:

Solution 1:

Here you just need to follow the following steps to solve this error:

  • Download tools_r25.2.3-windows.zip from Andriod Downloads.
  • Extract this zip file on the desktop.
  • Replace C:\Users\username\AppData\Local\Andriod\sdk\tools with sub-folder tools/
  • Go to your project folder and add;
$ cordova platforms remove andriod

$ cordova platforms add android

You may also need to force remove the node_modules in andriod. 

Sadly Andrios SDK tools 25.3.1 broke cordova-andriod 6.1.x:

For those who want to downgrade the SDK tools, you can install cordova-andrios from the URL as most of the errors are already fixed on the master branch

Cordova platform add https://github.com/apache/cordova-andriod

Solution 2:

  • If you have andriod studio installed on your system, then copy the templates folder from C:\Program Files\Andriod\Andrios Studio\plugins\andriod\lib\templates
  • Paste it the folder C:\Users\<user-name>\AppData\Local\Andriod\sdk\tools
  • Run the command
ionic build andriod

All the required jar files will be downloaded and an apk file for application will be generated.

 

11 5 2
3,890 points

Related questions

0 votes
1 answer 264 views
264 views
Problem : Currently I am learning Ionic I have recently created the ionic 2 project and also added the diagnostic cordova plugin as below: ionic plugin add cordova.plugins.diagnostic npm install --save @ionic-native/diagnostic and after that added the android platform as ... system to install the gradle wrapper. Please include gradle in your path, or install Android Studio How to fix above error?
asked Feb 26, 2020 mphil 2.3k points
0 votes
1 answer 2.1K views
2.1K views
Problem : I cleaned my whole project by deleting my local directories as following ~/.gradle, ~/.m2 ~./android and ~/workspace/project/.gradle and choosing the File -> Invalidate Caches / Restart... in my Android Studio. Now execution of my command ./gradlew leads to the ... say that I deleted too much code, the question now is how can it be repaired again? Do you have any solution to fix this?
asked Jan 18, 2020 jwilliam 3.9k points
0 votes
1 answer 1.8K views
1.8K views
Problem : I am trying to learn the Android and Ionic. If I run the ionic build android command in the root of the ionic project, I am facing below error: FAILURE: Build failed with an exception. Where: Script '/home/javad/Desktop/javadApp/platforms/android/CordovaLib/cordova. ... Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
asked Feb 18, 2020 mphil 2.3k points
0 votes
1 answer 62 views
62 views
Problem: I am at the moment facing below error in my android studio after importing my Project: Error:(16, 0) Gradle DSL method not found: 'android()' Possible causes: The project 'LoginActivity' may be using a version of Gradle that does not contain the method. ... fuctionality (eg: editing, debugging) will not work properly. Please guide me to get rid of the above problem as soon as possible.
asked Sep 1, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 79 views
79 views
Problem: After installing Android Studio 3.2 on my machine I was unable to run Java. I have already tried following jdk-8u181-windows-x64, jdk-10.0.2_windows-x64_bin, jdk-11_windows-x64_bin setting the PATH and also reinstalling everything many times still the result is the ... playing with it too much I think something went very wrong.So I decided to start from fresh and still unable to fix it.
asked Aug 31, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 4 views
4 views
Problem: error: gradle dsl method not found: 'testimplementation()'
asked 3 days ago Dan phillip 1.9k points
1 vote
1 answer 149 views
149 views
Problem : I am very new to Programming. I am trying to learn Android Programming with the help of tutorials. I have installed Android Studio (1.2RC0) on my machine. My newly installed Android Studio (1.2 RC0) always shows below error to me: Error running ... Please fix your project and try again.   I am unable to understand above Android error. Please guide me in fixing above Android error.
asked May 16, 2020 Martin K 6.6k points
0 votes
1 answer 5 views
5 views
Problem: could not resolve com.android.support:appcompat-v7:26.1.0.
asked 3 days ago Dan phillip 1.9k points
0 votes
1 answer 105 views
105 views
Problem : I have updated my Android Studio to 3.0 but now facing the lot of issues.. So now stopped on the point with below issue: Could not resolve all files for configuration ':applib:_lintClassPath'. > Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01. ... project :applib I am currently using latest gradle version as: "gradle-4.2.1-all.zip". Does anyone know what my issue can be?
asked Dec 17, 2019 alecxe 7.5k points