当我尝试生成android build时,我无法确定任务':compileDebugJavaWithJavac'错误的依赖性

时间:2019-09-19 06:07:02

标签: android gradle ionic3

**I'm getting this error. I have updated my project gradle before.**

我在这里使用的是android gradle 3.4.1,这是发行版网址。

  

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

这是我的build.gradle文件部分。请提出一些解决方案,因为我过去几天一直试图找出该错误。

 apply plugin: 'com.android.application'

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

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.

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

    }
}

这是我的cordovaLib build.gradle文件

   ext {
    apply from: 'cordova.gradle'
    cdvCompileSdkVersion = privateHelpers.getProjectTarget()
    cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}

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

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

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

group = 'org.apache.cordova'
version = '6.3.0'

android {
    compileSdkVersion cdvCompileSdkVersion
    buildToolsVersion cdvBuildToolsVersion
    publishNonDefault true

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
    }
    defaultConfig {
        minSdkVersion 14
    }
}

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'Cordova'
                url 'https://cordova.apache.org'
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'stevengill'
                        name 'Steve Gill'
                    }
                }
                scm {
                    connection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
                    developerConnection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
                    url 'https://git-wip-us.apache.org/repos/asf?p=cordova-android'

                }
            }
        }
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

artifacts {
    archives sourcesJar
}

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    configurations = ['archives']
    pkg {
        repo = 'maven'
        name = 'cordova-android'
        userOrg = 'cordova'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
        websiteUrl = 'https://cordova.apache.org'
        issueTrackerUrl = 'https://issues.apache.org/jira/browse/CB'
        publicDownloadNumbers = true
        licenses = ['Apache-2.0']
        labels = ['android', 'cordova', 'phonegap']
        version {
            name = '6.3.0'
            released  = new Date()
            vcsTag = '6.3.0'
        }
    }
}

在使用gradle 2.3版之前,我已经在Ionic 3中构建了该项目,但是现在要构建android构建,我将其更新为5.6.2

1 个答案:

答案 0 :(得分:0)

请在app.gradle中添加构建类型设置。添加版本{}和调试{}设置

buildTypes {

    release {

        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
        debuggable true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.Production
        buildConfigField "String", "SERVER_URL", '"http://192.131.543"'    
      }


    debug {
        debuggable true
        buildConfigField "String", "SERVER_URL", '"http://192.131.543"'

    }
}