【问题标题】:Error regarding static interface methods on my android project关于我的android项目上的静态接口方法的错误
【发布时间】:2020-06-28 14:26:04
【问题描述】:

我正在制作一个连接到星球大战 api 的项目,获取 json 对象回复并通过 recycleView(简而言之)将它们呈现在我的视图上。但是,我通过我的 gradle 文件(这里是完整的)在构建项目上遇到错误:

apply plugin: 'com.android.application'

android {

    // Configure only for each module that uses Java 8
    // language features (either in its source code or
    // through dependencies).
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    compileSdkVersion 28
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.juangm.bottomnavigationmvp"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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


    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test:rules:1.1.0'

    compile 'com.android.support:appcompat-v7:28.3.1'
    compile 'com.android.support:cardview-v7:28.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.1.3'
    compile 'com.android.support:design:28.3.1'
    compile 'com.android.support:support-v4:28.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.jakewharton:butterknife:8.3.2'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5'
    implementation 'com.jakewharton:butterknife-compiler:8.1.0'
    compile 'com.squareup.retrofit2:retrofit:2.5.0'
    compile 'com.squareup.retrofit2:converter-gson:2.5.0'
    compile 'com.squareup.okhttp3:okhttp:3.12.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
    compile 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.1.1'
}

我得到的错误:**仅从 Android N (--min-api 24) 开始支持静态接口方法: void butterknife.Unbinder.lambda$static$0() 堆栈跟踪: **

如您所见,我已经在gradle上添加了JAVA.version 1_8的编译选项,但似乎并没有解决问题。

感谢任何帮助...

【问题讨论】:

    标签: android static butterknife


    【解决方案1】:

    请按照以下方式将 Biutterknife 版本更新到最新版本并同步。观察过黄油刀

    implementation 'com.jakewharton:butterknife:10.2.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
    

    Android Studio 应更新至 4.0 版,以根据 Android 文档使用 Java 8 Desugaring。 Java 8 language features

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-17
      • 2015-06-15
      • 2013-11-12
      • 2013-04-12
      • 2014-06-02
      相关资源
      最近更新 更多