【问题标题】:Uncaught translation error: com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24未捕获的翻译错误:com.android.dx.cf.code.SimException:在没有 --min-sdk-version >= 24 的情况下使用默认或静态接口方法
【发布时间】:2018-04-09 00:41:15
【问题描述】:

使用 sbt android:run 在模拟器中运行我的 android 应用程序时遇到以下异常:

Uncaught translation error: com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24

不用说,我正在使用 Scala/SBT 并且对 android 领域是全新的。

我已经尝试了所有我能找到的解决方案,比如使用最新版本的 guava

"com.google.guava" % "guava" % "23.2-android"

或开启multidex

dexMulti in Android := true

这就是我的 build.sbt 的样子:

name := "Scala1"

version := "0.0.1"

scalaVersion := "2.12.3"

platformTarget := "android-26"

javacOptions in Compile ++= "-source" :: "1.8" :: "-target" :: "1.8" :: Nil

enablePlugins(AndroidApp)

dexMulti in Android := true

minSdkVersion in Android := "24"

libraryDependencies ++= Seq(
    "com.android.support" % "appcompat-v7" % "24.0.0",
    "com.google.guava" % "guava" % "23.2-android")

// libraryDependencies ++= Seq(
//     "com.android.support" % "appcompat-v7" % "24.0.0"
//     )

// Enable proguard and link it to the config file 'proguard-project.txt'
proguardOptions in Android ++= io.Source.fromFile("proguard-project.txt").getLines.toSeq

非常感谢任何形式的帮助。

【问题讨论】:

    标签: android scala sbt


    【解决方案1】:

    必须将build.sbt 中的 java 源和目标版本都更改为 1.7:

    javacOptions in Compile ++= "-source" :: "1.7" :: "-target" :: "1.7" :: Nil
    

    它现在就像一个魅力。

    【讨论】:

      猜你喜欢
      • 2017-12-12
      • 2016-11-20
      • 2019-11-23
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-10
      • 1970-01-01
      相关资源
      最近更新 更多