【发布时间】: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