I just migrated from eclipse to studio. I followed one blog to export project from eclipse to studio. The app working fine in lollipop and throwing the following error in pr
Your logcat returns
java.lang.NoClassDefFoundError: android.support.v7.appcompat
So update your support repository (Version 23) And ** For API 23:**
compile 'com.android.support:appcompat-v7:23.0.0'
In the android documentation for v7 appcompat is a note:
Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.
I think thats your problem since you have comment out the line in your gradle:
// compile "com.android.support:support-v4:18.0.+"
Add the line again and try to compile the project.
Also i see no com.android.support:appcompat-v7:21.0.0
line in your gradle
As I can see the gradle file you have posted here is top level gradle file,which contains stuff that should not be there. Replace your top level gradle file contents like below :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
May be a long shot, but ensure your images are under /res/drawable and not /res/drawable-v24 See this answer: Binary XML file line #0: Error inflating class ImageView
I faced the same issue and fixed it.
It is issue with Dex limit. Because the dex limit is reached, it creates two dex files. Lollipop knows how to read, pre-Lollipop has no idea unless you specify it in the Application
class.
Please make sure following is in place:
in build.gradle
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
defaultConfig {
multiDexEnabled true
}
IMPORTANT to support pre-Lollipop:
In Manifest, under the application tag,
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
Or if you have used your own Application
class,
make your Application
override attachBaseContext
starting with
import android.support.multidex.MultiDexApplication;
import android.support.multidex.MultiDex;
public class MyApplication extends MultiDexApplication {
// ......
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Reference: https://developer.android.com/tools/building/multidex.html#mdex-gradle