I cloned a project from git having some libraries added as part of grade build . This is the gradle dependencies part of the code
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'
}
This is the parent build.gradle file
// 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()
}
}
However on syncing the project I get the following error in 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
This issue occurred because I had checked offline work in gradle settings .Worked after unticking it
Checked this on another machine (non-latest DEV build). Checkbox "Maven Integration" is checked there, everything works. Updated to latest DEV build - still everything works. So, looks like, something has corrupted my config and checking
"Studio_File -> Settings -> Plugins" plugin "Maven Integration"
Is the solution. Anyway, I highly recommend to disable "Add library dependancy" (+tooltip with clarification) menu item if corresponding plugin is disabled. Or, at least, throw another understandable exception in order to save time of user, who will face with this issue. (I expect that I'm not the last one, who faced with this)
For Brief see here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With