首页 > 解决方案 > 当我尝试运行 ionic cordova build --release android 时出现错误

问题描述

cmd中的错误

配置项目:“com.android.build.gradle.AppPlugin@1e44fb53”的“未指定”的应用程序错误“插件版本”不是有效的版本号

FAILURE:构建失败并出现异常。

此项目使用 AndroidX 依赖项,但未启用“android.useAndroidX”属性。在 gradle.properties 文件中将此属性设置为 true 并重试。检测到以下 AndroidX 依赖项:androidx.fragment:fragment:1.3.4、androidx.slidingpanelayout:slidingpanelayout:1.0.0、androidx.appcompat:appcompat:1.4.0-alpha03、androidx.annotation:annotation:1.3.0-alpha01 , androidx.versionedparcelable:versionedparcelable:1.1.1, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.emoji2:emoji2-views-helper:1.0.0-alpha03, androidx.lifecycle :lifecycle-viewmodel-savedstate:2.3.1, androidx.interpolator:interpolator:1.0.0, androidx.annotation:annotation-experimental:1.1.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0 .0, androidx.collection:collection:1.1.0,

BUILD FAILED in 10s Command failed with exit code 1: C:\Users\jupun\Documents\Codecanyon\ionic5GroceryeeFull_v9\done\ionic5GroceryeeFull_v9\App_code\User_app\platforms\android\gradlew cdvBuildRelease -b C:\Users\jupun\Documents\Codecanyon \ionic5GroceryeeFull_v9\done\ionic5GroceryeeFull_v9\App_code\User_app\platforms\android\build.gradle [错误] 运行子进程cordova时出错。

    cordova.cmd build android --release exited with exit code 1.

这是离子 build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }

    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="29.0.2" //String
      defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
      defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

标签: androidcordovagradleionic-frameworkionic3

解决方案


推荐阅读