没有进行任何代码更改的Android Studio的Gradle构建失败

时间:2019-06-19 11:58:39

标签: android maven gradle

我面临一个奇怪的问题。几天前,相同的代码库正在运行,但今天却出现以下错误。

Could not find matching constructor for: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.VersionInfo(String)

我无法找到此错误背后的原因。你们中的任何一个都可以帮助您。

请在下面找到必填信息。

依赖性:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "com.android.support:appcompat-v7:${rootProject.ext.appCompatVersion}"
    implementation "com.crashlytics.sdk.android:crashlytics:${rootProject.ext.crashlyticsVersion}"
    implementation "com.android.support:design:${rootProject.ext.appCompatVersion}"
    implementation "com.android.support.constraint:constraint-layout:${rootProject.ext.constraintLayoutVersion}"
    implementation "com.android.support:recyclerview-v7:${rootProject.ext.appCompatVersion}"
    implementation "com.android.support:cardview-v7:${rootProject.ext.appCompatVersion}"
    implementation "com.onesignal:OneSignal:${rootProject.ext.onesignalVersion}"
    implementation "com.flaviofaria:kenburnsview:${rootProject.ext.kenburnsViewVersion}"
    implementation "com.firebase:firebase-jobdispatcher:${rootProject.ext.firebaseJobDispatcherVersion}"
    implementation "com.github.bumptech.glide:glide:${rootProject.ext.glideVersion}"

    //google admob
    implementation 'com.google.android.gms:play-services-ads:18.0.0'
    implementation 'com.google.firebase:firebase-messaging:+'
    implementation 'com.android.billingclient:billing:1.1'
    implementation "android.arch.persistence.room:runtime:${rootProject.ext.room_version}"
    annotationProcessor "android.arch.persistence.room:compiler:${rootProject.ext.room_version}"
    implementation "android.arch.lifecycle:livedata:${rootProject.ext.lifecycle_version}"
    annotationProcessor "android.arch.lifecycle:compiler:${rootProject.ext.lifecycle_version}"

    //below is for app tutor view
    implementation "com.github.amlcurran.showcaseview:library:${rootProject.ext.showcaseViewVersion}"

    //below two dependencies are for circular image transformation to gif by glide
    implementation "jp.wasabeef:glide-transformations:${rootProject.ext.glideTransformationsVersion}"
    implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'

    //below dependency is for bookmark star animation
    implementation "com.github.varunest:sparkbutton:${rootProject.ext.sparkButtonVersion}"

    //below dependency is for button with validation animation
    implementation "com.unstoppable:submitbutton:${rootProject.ext.submitButtonVersion}"

    //dependency for firebase auth
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.api-client:google-api-client:1.22.0'
    implementation 'com.google.api-client:google-api-client-android:1.22.0'
    implementation 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'

    //dependency for firebase db
    implementation 'com.google.firebase:firebase-database:16.0.2'

    //for signin button google custom
    implementation "com.shobhitpuri.custombuttons:google-signin:${rootProject.ext.googleSigninButtonVersion}"

    //youtube
    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    //support
    implementation "com.android.support:design:${rootProject.ext.appCompatVersion}"

    //webview
    implementation "com.thefinestartist:finestwebview:${rootProject.ext.fineWebviewVersion}"

    //speech to text module
    implementation project(path: ':speech-to-text', configuration: 'default')

    //viewmodel and livedata
    implementation "android.arch.lifecycle:extensions:${rootProject.ext.lifecycle_version}"
    androidTestImplementation 'junit:junit:4.12'

    //memory leaks detection
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'

    // Optional, if you use support library fragments:
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation 'com.android.support:multidex:1.0.3'

    //lottie
    implementation 'com.airbnb.android:lottie:2.5.0'
}

版本:

ext {
    compileSdkVersion=28
    minSdkVersion=19
    targetSdkVersion=28
    materialDesignVersion='1.0.0'
    appCompatVersion='28.0.0'
    crashlyticsVersion='2.9.9'
    constraintLayoutVersion='1.1.3'
    onesignalVersion='3.9.1'
    glideVersion='4.9.0'
    firebaseJobDispatcherVersion='0.8.5'
    kenburnsViewVersion='1.0.6'
    room_version='1.1.1'
    lifecycle_version='1.1.1'
    fineWebviewVersion='1.2.7'
    showcaseViewVersion='5.4.3'
    glideTransformationsVersion='3.3.0'
    sparkButtonVersion='1.0.5'
    submitButtonVersion='1.1.3'
    googleSigninButtonVersion='1.0.0'
    lifecycle_version="1.1.1"
}

我正在使用Gradle版本3.4.1 我尝试清理项目,重建项目,使缓存无效并重新启动。没有任何帮助。

P.S:我已经调查了this个问题,并且我正在使用OneSignal,并且需要它。

2 个答案:

答案 0 :(得分:1)

似乎OneSignal插件正在使用内部gradle API(VersionInfo在org.gradle.api.internal包下)。与公共Gradle API不同,Gradle团队可以在不发出警告的情况下更改内部API,并且不能保证它们在Gradle版本之间不会有重大变化。

也许您使用的是旧版本的OneSignal插件,但现在您的新版本的Gradle不再使用该插件。也许会有更新版本的插件可以正常工作?

无法跟踪插件作者并向项目提交错误,或者提交带有修复的请求请求

答案 1 :(得分:0)

我终于能够解决它。以下是我与OneSignal支持人员联系后发现的修复程序。

原因:来自OneSignal的更改影响了它。

修复: 1.我们实现OneSignal SDK的方式已更改,并且未通知用户。之前,这是实施的第一步。

plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.7.0'
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
maven { url 'https://maven.google.com' }
}

现在,您需要将其更改为

buildscript {
repositories {
    maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.2'
}
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
maven { url 'https://maven.google.com' }
}

进行上述操作将修复该错误。但是,我还必须将项目也迁移到androidX。 所以, 2.将项目迁移到androidX。

通过两个步骤修复了该错误。