10

编译代码时出现此错误:

错误日志

谁能帮助我如何解决此错误或可能导致此错误的原因?

Edit1:项目的 Gradle 文件。错误日志也附在上面的问题中。请检查它。

import com.google.gms.googleservices.GoogleServicesPlugin

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

android {

compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {

    applicationId "com.veblr.videomate"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 16
    versionName "1.0.0.8"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    aaptOptions.cruncherEnabled = true
    aaptOptions.useNewCruncher = false
    vectorDrawables.useSupportLibrary = true
    resConfigs "en"
}

buildTypes {

    debug {
        jniDebuggable true
        multiDexEnabled true
    }
    release {
        minifyEnabled false
        ///shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'

        //Other parameters
        debuggable false
        jniDebuggable false
        renderscriptDebuggable false
        pseudoLocalesEnabled false
        zipAlignEnabled true

    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
}
ext {
    roomVersion = '1.0.0'
    archLifecycleVersion = '1.1.0'
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/rxjava.properties'
    exclude 'META-INF/XXX'
    exclude 'META-INF/license/LICENSE.base64.txt'
    exclude 'META-INF/rxjava.properties'

}

compileOptions {
    targetCompatibility 1.8
    sourceCompatibility 1.8
}
dexOptions {
    jumboMode true
    preDexLibraries = false
    javaMaxHeapSize "12g" //specify the heap size for the dex process
    }
 }
afterEvaluate {
tasks.matching {
    it.name.startsWith('dex')
}.each { dx ->
    if (dx.additionalParameters == null) {
        dx.additionalParameters = ['--multi-dex']
    } else {
        dx.additionalParameters += '--multi-dex'
    }
    }


   }
 repositories {
    mavenCentral()
    maven { url "https://jitpack.io"
    }
maven {
    url 'https://maven.google.com/'
    name 'Google'

}
     maven{  url  "https://adcolony.bintray.com/AdColony"}
     maven {  url 'https://maven.fabric.io/public'
     }
    }
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.adcolony:sdk:3.3.0'
implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.firebase:firebase-measurement-connector- 
impl:17.0.5"

//noinspection GradleCompatible
implementation 'com.google.ads.mediation:facebook:4.27.0.0'
implementation 'com.facebook.android:audience-network-sdk:4.27.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.danikula:videocache:2.7.0'

//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'


//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'

implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
implementation 'com.android.support:multidex:1.0.3'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'

// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation "android.arch.lifecycle:viewmodel:1.1.1"

implementation 'android.arch.navigation:navigation-fragment:1.0.0-rc02'
implementation 'android.arch.navigation:navigation-ui:1.0.0-rc02'

}
apply plugin: 'com.google.gms.google-services'
GoogleServicesPlugin.config.disableVersionCheck = true
apply plugin: 'digital.wup.android-maven-publish'

我认为 java 编译器和 java sdk 有问题,如果是这样,请告诉我是否是问题以及如何解决。

4

5 回答 5

4

确保在您的项目 gradle buildscript 中使用最新版本

classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'

并尝试使用最新版本更新您的库版本

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.adcolony:sdk:3.3.0'
    implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
    implementation 'com.google.android.material:material:1.0.0'
    implementation "com.google.firebase:firebase-measurement-connector-impl:17.0.5"

//noinspection GradleCompatible
    implementation 'com.google.ads.mediation:facebook:4.27.0.0'
    implementation 'com.facebook.android:audience-network-sdk:4.27.0'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.danikula:videocache:2.7.0'

//noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'


//noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
    implementation 'com.firebaseui:firebase-ui-database:4.3.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'

    implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'

// Room components
    implementation 'android.arch.persistence.room:runtime:1.1.1'
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'junit:junit:4.12'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    androidTestImplementation 'com.android.support:support-annotations:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation "android.arch.lifecycle:viewmodel:1.1.1"

    implementation 'android.arch.navigation:navigation-fragment:1.0.0'
    implementation 'android.arch.navigation:navigation-ui:1.0.0'

}
于 2019-03-22T09:18:43.770 回答
0

--stacktrace使用或运行它--info--debug查看来自终端的更多日志输出信息,例如:./gradlew compileDebugJavaWithJavac --debug.

您将能够查看有关何时何地停止任务以及失败原因的更多信息。

于 2019-03-20T21:09:46.720 回答
0

在我的情况下,Publisher 类属于我的项目中缺少的 RxJava 库,因此在我的 app/gradle 文件中添加这两行可以解决问题:

实现'io.reactivex.rxjava2:rxandroid:2.1.1'

实现'io.reactivex.rxjava2:rxjava:2.xx'

于 2019-06-15T20:08:00.237 回答
-1

尝试更新最新版本:

  1. RxJavaio.reactivex.rxjava2:rxjava
  2. RxAndroidio.reactivex.rxjava2:rxandroid

然后,AndroidStudio -> 文件 -> 使 Cashes/Restart 无效。

它帮助了我。

于 2019-04-25T04:57:20.673 回答
-3

library有问题'com.google.firebase:firebase-core:16.0.8',当我在 app/gradle 中升级它时,它为我解决了这个问题。

于 2019-04-19T05:21:04.200 回答