# Ionic Apk Build error

**URL:** <https://forum.ionicframework.com/t/ionic-apk-build-error/151179>\
**Category:** ionic-v3\
**Created:** [December 24, 2018, 6:20am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179 "2018-12-24T06:20:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahdimunfarid](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mahdimunfarid](https://forum.ionicframework.com/u/mahdimunfarid)\
**Post date:** [December 24, 2018, 6:20am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/1 "2018-12-24T06:20:26Z")

</div>

i am new in ionic framewrok. i have created a project but when i try to build apk with `onic cordova build android`

there is an error

```auto
[ERROR] An error occurred while running subprocess cordova.

    cordova build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

```

and i tried to run

```auto
cordova build android --verbose

```

and get this

```auto
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Android Studio project detected
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\app\src\main\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\app\src\main\assets\www
Wrote out android application name "MyApp" to C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\app\src\main\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "io.ionic.starter" to C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\app\src\main\java\io\ionic\starter\MainActivity.java
Updating icons at platforms\android\app\src\main\res
Updating splash screens at platforms\android\app\src\main\res
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Users\zdx\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Running command: cmd "/s /c "C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\gradlew.bat cdvBuildDebug -b C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m""

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not find android-maven-gradle-plugin.jar (com.github.dcendents:android-maven-gradle-plugin:1.5).
     Searched in the following locations:
         https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Command finished with error code 1: cmd /s /c "C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\gradlew.bat cdvBuildDebug -b C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m"
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not find android-maven-gradle-plugin.jar (com.github.dcendents:android-maven-gradle-plugin:1.5).
     Searched in the following locations:
         https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not find android-maven-gradle-plugin.jar (com.github.dcendents:android-maven-gradle-plugin:1.5).
     Searched in the following locations:
         https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
    at ChildProcess.whenDone (C:\Users\zdx\Desktop\projects\ionic\simpleApp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

```

---

<div class="post-metadata">

**Author:** ![gokujy](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gokujy/32/117753_2.png) [@gokujy](https://forum.ionicframework.com/u/gokujy)\
**Post date:** [December 24, 2018, 7:17am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/2 "2018-12-24T07:17:32Z")

</div>

Try this…and run your build cmd again.

```auto
ionic cordova platform rm android
ionic cordova platform add android@6.3.0

```

---

<div class="post-metadata">

**Author:** ![Prakashanand](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Prakashanand](https://forum.ionicframework.com/u/Prakashanand)\
**Post date:** [December 24, 2018, 9:46am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/3 "2018-12-24T09:46:28Z")

</div>

Hi, Check your gradle version  
4.1 + version u can use this problem has solved so install gradle 4 above version then build on apk

---

<div class="post-metadata">

**Author:** ![mahdimunfarid](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mahdimunfarid](https://forum.ionicframework.com/u/mahdimunfarid)\
**Post date:** [December 27, 2018, 11:52am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/4 "2018-12-27T11:52:27Z")

</div>

hi the problem has been solved by adding

```
modify:
mavenCentral()
jcenter()

to:
maven { url "https://maven.google.com" }	
jcenter { url "http://jcenter.bintray.com/"}

in files:
platforms/android/build.gradle
platforms/android/app/build.gradle
platforms/android/CordovaLib/build.gradle
```

---

<div class="post-metadata">

**Author:** ![Jamila258](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jamila258](https://forum.ionicframework.com/u/Jamila258)\
**Post date:** [January 2, 2019, 10:22am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/5 "2019-01-02T10:22:40Z")

</div>

> [@mahdimunfarid](#):
>
> i am new in ionic framewrok. i have created a project but when i try to build [apk](https://ifacetimeapp.com/) with `onic cordova build android`
> 
> there is an error

I have the same error. It is still not resolved.

---

<div class="post-metadata">

**Author:** ![salomon022](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@salomon022](https://forum.ionicframework.com/u/salomon022)\
**Post date:** [January 12, 2019, 7:02am UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/6 "2019-01-12T07:02:30Z")

</div>

ionic cordova platform add android@latest

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:03pm UTC](https://forum.ionicframework.com/t/ionic-apk-build-error/151179/7 "2021-07-19T21:03:25Z")

</div>

Closed on July 19, 2021, 9:03pm UTC


