Problem compiling with Ionic

1

Recently I installed Ionic but until now I have not been able to compile any projects. This is the Ionic version:

PS C:\Users\Erik\Desktop\App1> ionic -v
3.19.0

And this is Cordova's:

 PS C:\Users\Erik\Desktop\App1> cordova -v
    8.0.0

Yes I have the environment variables in Windows of the JDK and the SDK. At the moment of compiling a new project with nothing added, it marks the following error (already with the android platform installed):

    PS C:\Users\Erik\Desktop\App1> ionic cordova build android
Running app-scripts build: --platform android --target cordova
[02:19:17]  build dev started ...
[02:19:18]  clean started ...
[02:19:18]  clean finished in 362 ms
[02:19:18]  copy started ...
[02:19:22]  deeplinks started ...
[02:19:22]  deeplinks finished in 603 ms
[02:19:23]  transpile started ...
[02:20:10]  transpile finished in 46.97 s
[02:20:10]  preprocess started ...
[02:20:10]  preprocess finished in 9 ms
[02:20:10]  webpack started ...
[02:20:10]  copy finished in 52.22 s
[02:21:04]  webpack finished in 54.43 s
[02:21:04]  sass started ...
Without 'from' option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to 'undefined' to prevent this warning.
[02:21:22]  sass finished in 17.62 s
[02:21:23]  postprocess started ...
[02:21:24]  postprocess finished in 1.56 s
[02:21:24]  lint started ...
[02:21:25]  build dev finished in 127.26 s
> cordova build android
Android Studio project detected

ANDROID_HOME=C:\Users\Erik\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0
studio
Subproject Path: CordovaLib
Subproject Path: app




FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Erik\Desktop\App1\platforms\android\CordovaLib\build.gradle' line: 40

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> Failed to apply plugin [id 'com.android.library']
   > Could not create plugin of type 'LibraryPlugin'.
      > java/io/UncheckedIOException

* 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 10s
(node:5192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code

Here is the file where the error is:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    }
}

->Linea 40 apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray

When compiling the same project in Android Studio I do not have problems but it is a bit annoying to change from Ionic to Android Studio. I appreciate any contribution

    
asked by Erik 16.01.2018 в 09:33
source

1 answer

0

This happens when compiling for Android 7+, in my case I have to compile in the version of Android 6.3.0.

Note: With SDK Manager verify that you have API 23 .

To compile in the version of Android 6.3.0 it is necessary to execute the command:

ionic cordova platform remove android

After removing the platform it is necessary to indicate to Ionic that the new platform we want in a specific version:

ionic cordova platform add [email protected]

recompile:

ionic cordova build android
ionic cordova run android --device

Note: When compiling with Ionic , the gradle is automatically downloaded.

    
answered by 17.01.2018 в 18:26