你好我是android studio的新手。我有一個現有的eclipse項目,只能運行在(2.3.3 android api 10)上。從eclipse遷移到android studio時出錯
當我將現有的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。這與你的項目無關,只是你的系統。 – mhenryk
我已經有了一個更新的java版本1.7.0_75。但它不起作用。 –