Ionic pro package failed after successful deploy

same problem here :frowning:

I found a solution for my app:

First: I remove Cordova-android plugin and re-install 6.4.0 version

rm -rf platforms/ plugins/
cordova prepare

Install this dependence: cordova-check-plugins and update all cordova plugins

After this actions, app is building working properly on my laptop / ionic pro :=)

Cheers

I am having the same issue, after applying your given solution that error resolved, but its now giving another error related gradlew

  • Where:

Script ‘/Users/ahsanejaz/Documents/softcircles/phone/ionic/inigrams/code/inigrams/platforms/android/CordovaLib/cordova.gradle’ line: 68

  • What went wrong:

A problem occurred evaluating project ‘:CordovaLib’.

> No installed build tools found. Install the Android build tools version 19.1.0 or higher.

Any idea how to get over it?
Thank you

@lucasmds - that’s awesome - thanks so much.

Check if your build tools are indeed installed.
Open the SDK Manager, go to ‘SDK Tools’ and check the ‘Show Package Details’, you should see all versions.

The next thing i can think of is to check if “platform-tools” and “tools” are in the PATH.

Thanks for reply dude. looked like my path variables were not rightfully pointing to my sdk tools.
In nut shell, i have successfully generated the .apk but it always is showing the device is ready screen which is the index page which is present in the www folder by default, i generated apk by using command “cordova build android --prod” and i have made sure that i am setting my out directory to www in angular 4 project angular-cli.json file. I have have updated the default base route from “/” to “./” in my angular project’s index.html file. Any help would be appreciated.
As I am new to ionic, i don’t know even if i am following the right tutorial for my use case (conversion of angular5 project to android).

Thanks.

Hi. I have the same problem.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-vector-drawable.aar (com.android.support:support-vector-drawable:27.1.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-vector-drawable/27.1.1/support-vector-drawable-27.1.1.aar
> Could not find livedata-core.aar (android.arch.lifecycle:livedata-core:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.aar
> Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
> Could not find runtime.aar (android.arch.core:runtime:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/runtime/1.1.0/runtime-1.1.0.aar

i’m testing some solutions with no luck at the moment.

With @lucasmds solution, still have issues.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-vector-drawable.aar (com.android.support:support-vector-drawable:27.1.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-vector-drawable/27.1.1/support-vector-drawable-27.1.1.aar

@AhsanSoftcircles, i dont know how to help you with that, sorry.

@TheTourist after some searching i came across with:

1 - Add google() to the “\platforms\android\CordovaLib\build.gradle” file

repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

If doesn’t work, add “google()”: in “\platforms\android\build.gradle

buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    // ...
}

allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    // ...
    }
}

2- Try to update android-cordova

Remove the platform, then:

cordova platform add android@7.1.1

:point_up: The Ionic Pro Package build for Android is also failing since yesterday

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

The method proposed by @lucasmds works perfectly for me !! Thank you very much !

I have had the same/similar issue both locally and when packaging (building) on Ionic Pro:

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
> Could not find support-v4.aar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar

I could sort this locally by updating cordova-android:
ionic cordova platform rm android
and then
ionic cordova platform add android@7.1.1
as suggested by @lucasmds

I did not have to update the repository paths.

However, this currently only works locally and Ionic Pro still fails with:

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

EDIT
There is also this article, but it didn’t fix my Ionic Pro build

To make it work I had to edit both platforms/android/CordovaLib/build.gradle and platforms/android/app/build.gradle and put jcenter() after maven and google() before both of them like

//  platforms/android/CordovaLib/build.gradle
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
// platforms/android/app/build.gradle
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

Moving the maven tag before the jcenter() tag in the “platforms\android\build.gradle” file like shown below, does solve our issue locally:

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

Hovever this solution is not viable on our automatic pipeline build, since we can’t manully change the content of the build.gradle file, while Cordova is actually building the platforms android library and creating an .apk file.

In our local build system we added a after_platform_add hook

module.exports = function(ctx) {
    'use strict';
    var fs = ctx.requireCordovaModule('fs'),
        path = ctx.requireCordovaModule('path'),
        deferral = ctx.requireCordovaModule('q').defer(),
        replaceStream = require('replacestream'),
        async = require('async');
    var platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
    var gradleFiles = [path.join(platformRoot, 'build.gradle'), path.join(platformRoot, 'CordovaLib', 'build.gradle')];
    async.each(gradleFiles, function(f, cb) {
        fs.readFile(f, 'utf8', function(err, data) {
            if (err) {
                cb(err);
                return;
            }
            var result = data.replace(/repositories {(?:\n\s*)?jcenter\(\)(?:\n\s*)?maven {(?:\n\s*)?url "https:\/\/maven\.google\.com"(?:\n\s*)?}(?:\n\s*)?}/g, 'repositories { maven { url "https://maven.google.com" }; jcenter() }');
            fs.writeFile(f, result, 'utf8', cb);
        });
    }, function(err) {
        if (err) {
            deferral.reject();
        } else {
            deferral.resolve();
        }

    });
    return deferral.promise;
}

it requires “replacestream”: “^4.0.3” to be installed

Thank @lucasmds this worked for me

Hey having the same problem. i\ve made all the changes in here but still getting the error message:

Blockquote Could not resolve all files for configuration ‘:CordovaLib:classpath’.
Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

Blockquote

I\ve even tried removing the jcenter(), nothing. Any other solutions

This solution worked for me locally: https://stackoverflow.com/questions/52974685/ionic-could-not-find-support-vector-drawable-aar

I solved my problem with the following command in my pipeline:

sed -i '/jcenter()/i \        google()' ./platforms/android/CordovaLib/build.gradle

How did you run that command