某些输入文件在android studio 3.0中使用或覆盖已弃用的API

时间:2018-05-03 13:54:40

标签: android

我更新了我的gradle版本4.4然后构建我的apk它显示我错误

Error:Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

* 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

发生此错误后,我在默认设置>>中添加了Xlint:unchecked。 Java编译器>>其他命令行参数(文本框)

但它没有解决,所以请帮我解决。

app.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.ejobbox.ejobbox"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 2
        versionName "1.1"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '27.0.3'
}

repositories {
    // You can also use jcenter if you prefer
    mavenCentral()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}

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


    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //Add New Dependency and compile
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'cc.cloudist.acplibrary:library:1.2.1'
    implementation 'io.paperdb:paperdb:2.6'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    //Searchable Dependency
    implementation 'com.github.MdFarhanRaja:SearchableSpinner:1.9'
    // google Services Depedency

    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    implementation 'com.google.firebase:firebase-crash:15.0.0'
    implementation 'com.google.firebase:firebase-invites:15.0.1'
    implementation 'com.google.firebase:firebase-database:15.0.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    //compile 'com.google.firebase:firebase-ads:15.0.0'

}

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

此外,我在实现'com.android.support:appcompat-v7:27.1.0'implementation 'com.google.firebase:firebase-core:15.0.0'中发现相同的版本规范警告然后我尝试更改它的版本并检查所有新版本但是警告因为它是这样我已经用{{修复它1}}。

请检查并告诉我如何解决此错误。 感谢

1 个答案:

答案 0 :(得分:0)

之后的defaultConfig {}中添加以下代码

代码:flavorDimensions" app"

参考链接:

https://developer.android.com/studio/build/build-variants

https://proandroiddev.com/advanced-android-flavors-part-2-enter-flavor-dimensions-4ad7f486f6

添加此代码后,让我知道任何错误。