android - 将Android Gradle 3.0更新为5.1在运行时出现错误

标签 android gradle android-gradle-plugin

我正在尝试为我的应用程序升级gradle和库,出现运行时错误,如下所示

FAILURE: Build failed with an exception.

* What went wrong:
 Execution failed for task ':UIModule:compileDevDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

Gradle :-
buildscript {
repositories {`enter code here`
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    google()

}

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.0'
    classpath 'io.fabric.tools:gradle:1.+'

   }
 }
    apply plugin: 'com.android.application'
       apply plugin: 'io.fabric'

 repositories {

mavenCentral()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}


 android {
flavorDimensions "default"
signingConfigs {
    config {
    }
}
compileSdkVersion 26
buildToolsVersion '26.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.kisan.samvaad"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 128
    versionName "1.32.20190424.00"
    multiDexEnabled true

    //giving support for ndk
    ndk {
        moduleName "webp"
    }
    //getting error some file crunching fail
    aaptOptions {
        cruncherEnabled = false
    }

}
buildTypes {
    debug {
        minifyEnabled false
        debuggable true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
  'proguard-rules.pro'
    }
    release {
        minifyEnabled false
        multiDexEnabled true
        proguardFiles getDefaultProguardFile("proguard-android.txt"), 
  "proguard-rules.pro"
    }
}

defaultConfig{
    vectorDrawables.useSupportLibrary = true
}

ext {
    enableCrashlytics = true
}

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
}
repositories {
    maven { url 'http://leocad.io/mvn' }
    maven { url "https://jitpack.io" }
}

productFlavors {
    Dev {
        applicationIdSuffix ".dev"
    }

    Staging {
        applicationIdSuffix ".staging"
    }
    Prod {

    }
}
sourceSets { Prod { java.srcDirs = ['src/Prod/java', 'src/Prod/java/'] 
} }

sourceSets.main {
    jniLibs.srcDir 'libs'
    jni.srcDir s = [] //disable automatic ndk-build call
}
  }

 ext {
smackVersion = '4.2.3'
}
configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
 }

 dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-
core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-
 annotations'
})
implementation files('libs/httpmime-4.2.5.jar')
implementation files('libs/aspectjrt-1.7.3 (1).jar')
implementation files('libs/isoparser-1.0.6.jar')
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:animated-vector-drawable:26.+'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:recyclerview-v7:26.+'
implementation 'com.android.support:exifinterface:26.+'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.nostra13.universalimageloader:universal-image-
 loader:1.9.5'
implementation 'com.github.ozodrukh:CircularReveal:1.1.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.2.1'
implementation 'com.google.android.gms:play-services:11.0.2'
implementation 'com.google.android.gms:play-services-maps:11.0.2'
implementation 'com.google.android.gms:play-services-location:11.0.2'
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
implementation 'io.jsonwebtoken:jjwt:0.6.0'
implementation 'com.android.support.constraint:constraint-
 layout:1.0.2'
implementation 'junit:junit:4.12'
implementation 'com.facebook.android:account-kit-sdk:4.27.0'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation('org.igniterealtime.smack:smack-android-
 extensions:4.1.7') {
    exclude module: 'smack-omemo'
    exclude module: 'smack-omemo-signal'
  }

implementation "org.igniterealtime.smack:smack-tcp:$smackVersion"
implementation "org.igniterealtime.smack:smack-
experimental:$smackVersion"
implementation("org.igniterealtime.smack:smack-android:$smackVersion") 
{
    exclude module: 'smack-omemo'
    exclude module: 'smack-omemo-signal'
}
implementation "org.igniterealtime.smack:smack-im:$smackVersion"
implementation "org.igniterealtime.smack:smack-legacy:$smackVersion"
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
testImplementation 'junit:junit:4.12'
implementation project(':BusinessLogicModule')
implementation project(':sdkui')
ext.enableCrashlytics = true
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}


 apply plugin: 'com.google.gms.google-services'

最佳答案

给定编译错误,您很有可能会遇到以下变化:Gradle 5.x将不再将在Maven元数据中声明的依赖项作为<scope>runtime</scope>放置在编译类路径上。看看migration notes

调试此问题最简单的方法是运行:./gradlew :UIModule:dependencies --configuration <configurationName>,其中<configurationName>被正确的名称替换,我不知道。如果没有可用的信息,只需运行不带--configuration参数的任务即可。
在新旧版本的Gradle上运行此命令,可以找出差异并通过在有意义的地方添加缺失的依赖项来解决差异。

请注意,从3.x跳到5.x可能还会迫使您执行进一步的更新。

关于android - 将Android Gradle 3.0更新为5.1在运行时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56065679/

相关文章:

spring-boot - 使用 Gradle 和 Spring Boot Gradle 插件时,如何从不同的模块复制 Spring Boot 重新打包的 jar?

mysql - sonarqube 将结果存储在数据库中花费的时间太长

android - 用口味替换启动 Activity

android - 如果从 Jenkins 运行,Crashlytics gradle 插件找不到 APK

Android 进度对话框这么晚才出现?

android - 如何在 Android 中为 Vpn 断开连接添加额外的处理?

android - eclipse 错误。检查 Eclipse 日志中的堆栈跟踪

Android mediaScannerConnection.scanFile 无法刷新图库中的图像

java - 遗留项目结构 : intellij recognizes gradle subproject as module but doesn't recognize its source code

gradle - 升级到android gradle插件3.0.0+后,项目无法构建