我從git中克隆了一個項目,並在作爲等級構建的一部分中添加了一些庫。這是代碼從git導入項目時出現NoClassDefFound錯誤
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.example.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories { mavenCentral() }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
}
這的gradle這個依賴部分家長的build.gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
但是在同步的項目中,我得到以下錯誤的logcat
5:51:36 PM NoClassDefFoundError: org/jetbrains/idea/maven/model/MavenArtifactInfo: org/jetbrains/idea/maven/model/MavenArtifactInfo 5:51:41 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 5:51:49 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 5:51:55 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 5:52:10 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 5:53:32 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 5:56:56 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog 6:03:26 PM NoClassDefFoundError: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog: Could not initialize class com.android.tools.idea.structure.MavenDependencyLookupDialog
顯示整個build.gradle文件和父目錄中的所有父build.gradle文件 – 2015-02-23 12:48:28