我从 git 克隆了一个项目,其中添加了一些库作为 grade build 的一部分。这是代码的gradle依赖部分
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'
}
这是父级的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
最佳答案
出现这个问题是因为我在 gradle settings 中检查了 offline work 。取消勾选后工作
关于java - 从 git 导入项目时出现 NoClassDefFounderror 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28674082/