【发布时间】:2015-07-22 07:35:01
【问题描述】:
你好,我是安卓工作室的新手。我有一个现有的 Eclipse 项目,仅在 (2.3.3 android api 10) 上运行。
当我将现有的 eclipse 项目迁移到 android studio 时。我面临以下错误。
Error:Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'.
Possible causes for this unexpected error include:
You are using JDK version 'java version "1.7.0_75"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle.
Please update to a newer version (e.g. 1.7.0_67).
Open JDK Settings
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
这是我的 build.gradle 文件。
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
}
android {
compileSdkVersion 10
buildToolsVersion "10"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
defaultConfig {
minSdkVersion 8
targetSdkVersion 10
}
}
谁能帮帮我。提前致谢。
【问题讨论】:
-
错误本身不是说的吗?请更新您的 JDK。这与您的项目无关,仅与您的系统有关。
-
我已经有一个更新的 java 版本 1.7.0_75。但它不起作用。
标签: android eclipse android-studio