I just imported my project which worked fine from Eclipse to Android Studio v1.2.11 and now the project is no longer working with the following error which make the app crashes at onCreate() method:
java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11.
I have updated updated my app to the latest v7 library, i.e. 22.1.1. below is my gradle.build dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:support-v4:19.1.0') {
force = true
}
compile('com.google.android.gms:play-services-base:7.3.0') {
force = true
}
compile 'com.google.android.gms:play-services-plus:7.3.0'
compile 'joda-time:joda-time:2.7'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile('com.facebook.android:facebook-android-sdk:3.22.0#aar') {
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'bolts'
}
compile 'com.google.guava:guava:18.0'
compile project(':PullToRefreshListView')
compile project(':CircularImageView')
compile project(':CountryPicker')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v13:22.1.1'
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
NB: I am using Theme.AppCompat.Light in my styles which I believe supports ActionBar. What I want to achieve is the Nav. drawer but the app doesn't go past the onCreate(). Any help with this exception will be highly appreciated
For anyone having similar issue, I was able to solve this and thought I should share with others. The error was due to my configuration as I was excluding the android.support in my project. Once I commented it, it just vanished.
Make sure your class dependency is in your application specific build.gradle file, not your global build.gradle file.
Related
I've the below dependence in my Android app build.gradle
compileSdkVersion 25
buildToolsVersion "25.0.2"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.6.0'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
but getting an error about versions compatibility, as shown below, what is the one to be changed here, i could not figure it out :(
I had same problem what i did was compile the higher version of libraries ,which were creating this error,in app:gradle only.
for example in your case
compile 'com.android.support:mediarouter-v7:25.0.0'
Add this in app:gradle.
There may be more like this mediarouter libraries if it still give error add them jst like this(making them higher version).
First you need to find out where's what consists of a conflicting version of the library. The easiest way to do so is to:
Open Terminal pane in your Android Studio.
Type in: ./gradlew androidDependencies
Find the row that represents the ENCLOSING library consisting of a conflict.
Then just use exclude statement for the conflicting library, like so:
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
(the example assuming com.android.support.test.espresso:espresso-core:2.2.2 was the ENCLOSING library, and com.android.support:support-annotations being the conflict)
Every time I create a new Activity in AS 2.3 it messes up the build.gradle indentation that results in errors like this.
Error:Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I have to redo the indentations every time. Any idea how to fix this permanently?
Don't use compile as a property and don't change the gradle structure.
compile 'com.android.support:appcompat-v7:22.2.1' compile
'com.parse:parse-android:1.11.0'
Sometimes Gradle build messes up the code like above, it still happens. Probably related to Java JDK updates.
The problem seems to be caused by the lines which contain curly braces like:
compile('com.github.tony19:logback-android-core:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
In order to avoid the bug just put all the lines with curly braces above the "usual" (i.e. compile 'something') lines like this:
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.github.tony19:logback-android-core:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
compile('com.github.tony19:logback-android-classic:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
compile 'com.bolyartech.forge.android:forge-android:6.1.0'
compile 'com.bolyartech.scram_sasl:scram_sasl:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup:otto:1.3.6'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.franmontiel:PersistentCookieJar:v0.9.3'
compile 'com.google.dagger:dagger:2.9'
...
Gradle build is stuck while running project.
I have included symja-2015-08-09.jar file in libs folder.
I have no other dependencies and no other external jar files.
Can anyone please suggest any solution.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
The app runs fine after removing the jar file.
Has anyone used symja libraries in their android projects before?
You can try, clean the project then rebuild it. It may work. But first of all make sure you have installed proper android SDK
I have an old eclipse based project , and i converted it to android studio based. The convertion success, but i have problem when adding other dependency, first i get error java.exe finished with non-zero exit value 2, because of duplicate dependency support v4, and i try to exlude modul support v4, but now im getting java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
this is my build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':SlidingMenu')
compile project(':PhotoView')
compile project(':viewpager')
compile project(':StackBlur')
compile project(':FacebookSDK')
compile files('libs/LibAllShareInterface_2.0.0.jar')
// Exclude module support-v4 to remove duplicate
compile ('com.android.support:appcompat-v7:22.2.0') { exclude module: 'support-v4' }
compile('com.android.support:design:22.2.0') { exclude module: 'support-v4' }
compile('com.squareup.picasso:picasso:2.5.2') { exclude module: 'support-v4' }
compile('com.android.support:recyclerview-v7:21.0.0') { exclude module: 'support-v4' }
compile('com.android.support:cardview-v7:22.2.0') { exclude module: 'support-v4' }
compile('com.android.support:support-annotations:22.2.0') { exclude module: 'support-v4' }
}
Any help will be appreciated
Well although I am not gradle expert and I'm experiencing some problems myself, I was able to reproduce an error complaining about appcompat-v4, using your dependencies.
It seems that you are completely excluding support-v4 from all your dependencies, and since support-v4 is required, you must either specify it as a dependency separately, or change this:
compile ('com.android.support:appcompat-v7:22.2.0') { exclude module: 'support-v4' }
to this:
compile ('com.android.support:appcompat-v7:22.2.0')
so you don't exclude support-v4 completely from your project.
I did the second and the project could build (A sample project with just those dependencies defined).
I'm using Android Studio 0.6.1, with Crouton library and today after gradle sync I got next error:
Error:A problem occurred configuring root project 'project_name'.
Module version de.keyboardsurfer.android.widget:crouton:1.8.4 depends on libraries but is not a library itself
That's going on?
This issue due to com.android.support-v4 recent update.
So I changed
compile 'com.android.support:support-v4:20.+'
to
compile 'com.android.support:support-v4:19.1.+'
and crouton works fine
Different workaround is to use #aar:
compile('de.keyboardsurfer.android.widget:crouton:1.8.4#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
My solution according to #Revedko answer, using #aar and change all supports to version lower than 21 -> 20.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.loopj.android:android-async-http:1.+'
compile "com.bugsense.trace:bugsense:3.5"
compile('de.keyboardsurfer.android.widget:crouton:1.8.4#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:5.0.77'
}