【问题标题】:Installing Java 7 along with already installed Java 8 to be able to build Android application安装 Java 7 和已安装的 Java 8 以便能够构建 Android 应用程序
【发布时间】:2014-04-28 02:33:14
【问题描述】:

我刚搬到新的 Ubuntu,因此安装了最后一个 Java 版本,即 8(或 1.8)。我还安装了 Android Studio 0.5.7。但是,Dalvik 不支持 Java 8,是吗?我想保持安装当前的 java 8,因为我将在 Java 项目中使用它,但我还必须安装 Java 7 才能在 Android 中使用它。这样做的正确方法是什么?

更新:

错误:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find any version that matches com.android.support:appcompat-v7:+.
     Required by:
         MyApplication:app:unspecified

#app/build.grandle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

【问题讨论】:

  • 您可以使用 Java 8 编译成 Java 7(或 Java 6)字节码。
  • 告诉 AS 使用你的 Java 8 安装。
  • @Code-Guru,确实如此,但它似乎听不懂我的口音。还有其他方法吗?
  • 你尝试的时候发生了什么?
  • @Code-Guru,已更新。在“项目结构”-> SDK 位置我有“/usr/local/java/jdk1.8.0_05”,这是 jdk8 的正确路径。

标签: java android linux android-studio


【解决方案1】:

错误

找不到任何与 com.android.support:appcompat-v7:+ 匹配的版本。

Android Studio could not find any version that matches com.android.support:appcompat-v7:+回答

即在 SDK Manager 中安装/更新 Extras / Android Support Repository 以使用此依赖项。

【讨论】:

    猜你喜欢
    • 2014-12-07
    • 2017-12-08
    • 1970-01-01
    • 2014-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-29
    • 1970-01-01
    相关资源
    最近更新 更多