App running in emulator but not in devices - android

I have an app that uses a basic layout for the main page.
Layout:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer"/>
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.DrawerLayout>
Gradle file:
android {
compileSdkVersion 23
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.ramyoogesh.android.navigationtest"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
testCompile 'junit:junit:4.12'
}
When I run the app in a Marshmallow emulator, it is running fine. However, when I try to run the app in my KitKat device, it starts throwing this error:
01-17 09:39:59.788 3661-3661/com.ramyoogesh.android.navigationtest E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ramyoogesh.android.navigationtest, PID: 3661
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ramyoogesh.android.navigationtest/com.ramyoogesh.android.navigationtest.MainActivity}: android.view.InflateException: Binary XML file line #41: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.ramyoogesh.android.navigationtest.MainActivity.onCreate(MainActivity.java:31)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5292) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.ramyoogesh.android.navigationtest.MainActivity.onCreate(MainActivity.java:31) 
at android.app.Activity.performCreate(Activity.java:5264) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5292) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f02005a
at android.content.res.Resources.getValue(Resources.java:1133)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:320)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems(NavigationMenuPresenter.java:495)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.update(NavigationMenuPresenter.java:436)
at android.support.design.internal.NavigationMenuPresenter.updateMenuView(NavigationMenuPresenter.java:112)
at android.support.design.widget.NavigationView.inflateMenu(NavigationView.java:245)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:169)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:95)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.ramyoogesh.android.navigationtest.MainActivity.onCreate(MainActivity.java:31) 
at android.app.Activity.performCreate(Activity.java:5264) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5292) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) 
at dalvik.system.NativeStart.main(Native Method) 
I am guessing that there must be some error in either the XML or the gradle file. I tried changing the appcompat-v7 to various versions but the error still exists.

I think you are using VectorDrawable and you have not implemented it in such a way that it is supported in Kitkat. Just check your nav_header_main layout and if your using a vectorDrawable, check this link on how to support it below lollipop.

Related

how am i going to fix this problem please

Can someone please help me, my application is always stopping and i can't fix it here's my codes
and this is my two gradles
1st gradle
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
2nd gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.raynard.kopiaveandroidapplication"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0 '
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
}
apply plugin: 'com.google.gms.google-services'
this is what my logcat says
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.raynard.kopiaveandroidapplication/com.example.raynard.kopiaveandroidapplication.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class info.hoang8f.widget.FButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class info.hoang8f.widget.FButton
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.raynard.kopiaveandroidapplication.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.raynard.kopiaveandroidapplication.MainActivity.onCreate(MainActivity.java:16) 
at android.app.Activity.performCreate(Activity.java:5990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:404)
at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
at info.hoang8f.widget.FButton.<init>(FButton.java:52)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.raynard.kopiaveandroidapplication.MainActivity.onCreate(MainActivity.java:16) 
at android.app.Activity.performCreate(Activity.java:5990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Error inflating class info.hoang8f.widget.FButton
There is an issue:
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x5
Seems like the error comes from the added library info.hoang8f.widget.FButton which couldn't convert to color. Check the value and see if it has the correct format.

App crashing with error 'Unfortunately, Calculator has stopped' in Android KitKat 4.4.4 version mobile

I am running my Calculator app from Android studio in KitKat 4.4.4 version mobile and I get the error 'Unfortunately, Calculator has stopped'. Below is the error got from Logcat from Android Studio:
03-03 10:18:14.279 3583-3583/com.saashtechs.saashcalculator E/dalvikvm: Could not find class 'java.util.Locale$Builder', referenced from method com.android.calculator2.CalculatorNumericPadLayout.onFinishInflate
03-03 10:18:14.319 3583-3583/com.saashtechs.saashcalculator E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.saashtechs.saashcalculator, PID: 3583
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.saashtechs.saashcalculator/com.android.calculator2.CalculatorGB}: android.view.InflateException: Binary XML file line #26: Error inflating class Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2429)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)
at android.app.ActivityThread.access$800(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5590)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class Button
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:720)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:762)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771)
at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.android.calculator2.Calculator.onCreate(Calculator.java:149)
at com.android.calculator2.CalculatorGB.onCreate(CalculatorGB.java:27)
at android.app.Activity.performCreate(Activity.java:5447)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493) 
at android.app.ActivityThread.access$800(ActivityThread.java:166) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5590) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/pad_button_background.xml from drawable resource ID #0x7f060060
at android.content.res.Resources.loadDrawable(Resources.java:3453)
at android.content.res.TypedArray.getDrawable(TypedArray.java:614)
at android.view.View.<init>(View.java:3585)
at android.widget.TextView.<init>(TextView.java:698)
at android.widget.Button.<init>(Button.java:107)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:66)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:62)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1029)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1087)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:762) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:858) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:499) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.android.calculator2.Calculator.onCreate(Calculator.java:149) 
at com.android.calculator2.CalculatorGB.onCreate(CalculatorGB.java:27) 
at android.app.Activity.performCreate(Activity.java:5447) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493) 
at android.app.ActivityThread.access$800(ActivityThread.java:166) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5590) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #18: invalid drawable tag ripple
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:969)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:913)
at android.content.res.Resources.loadDrawable(Resources.java:3449)
at android.content.res.TypedArray.getDrawable(TypedArray.java:614) 
at android.view.View.<init>(View.java:3585) 
at android.widget.TextView.<init>(TextView.java:698) 
at android.widget.Button.<init>(Button.java:107) 
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:66) 
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:62) 
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109) 
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1029) 
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1087) 
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:762) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:858) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:771) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:499) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.android.calculator2.Calculator.onCreate(Calculator.java:149) 
at com.android.calculator2.CalculatorGB.onCreate(CalculatorGB.java:27) 
at android.app.Activity.performCreate(Activity.java:5447) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493) 
at android.app.ActivityThread.access$800(ActivityThread.java:166) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5590) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096) 
at dalvik.system.NativeStart.main(Native Method) 
Can anyone please help why I getting this error?
Also, please let me know which are the files I need to show here so that you guys can fix this error
Below is the 'build.gradle' file code:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
}
}
apply plugin: "com.android.application"
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.sg.calculator"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
sourceSets {
main {
manifest.srcFile "AndroidManifest.xml"
java.srcDirs = ["src"]
res.srcDirs = ["res"]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenLocal()
maven {
url "https://maven.google.com"
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile files('exp4j-0.4.8.jar')
compile files('nineoldandroids-2.4.0.jar')
}
XML file:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/display"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/display_background_color"
android:elevation="4dip">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:id="#+id/tb"
android:theme="#style/CalculatorTheme"
android:title=""
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RAD"
android:background="#null"
android:id="#+id/rad"
android:textSize="20sp"
android:onClick="onButtonClick"
android:theme="?android:attr/borderlessButtonStyle"
android:minWidth="5dp"
android:minHeight="5dp" />
</android.support.v7.widget.Toolbar>
<com.android.calculator2.CalculatorEditText
android:id="#+id/formula"
android:layout_below="#+id/tb"
style="#style/DisplayEditTextStyle.Formula"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textNoSuggestions"
android:textColor="#color/display_formula_text_color" />
<com.android.calculator2.CalculatorEditText
android:id="#+id/result"
style="#style/DisplayEditTextStyle.Result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/formula"
android:inputType="text"
android:focusable="false"
android:textColor="#color/display_result_text_color" />
</RelativeLayout>
'res/drawable/pad_button_background.xml' file code:
<ripple xmlns:
android="http://schemas.android.com/apk/res/android"
android:color="#color/pad_button_ripple_color" />
Thanks in advance
RippleDrawable - added in API level 21
So you need to move that XML file to at least a res/drawable-v21 folder. (Make if not exists)
Also see - How to achieve ripple animation using support library?

InflateException : Error inflating class android.support.design.widget.NavigationView

I am able to test my android app on my mobile 5.0 perfectly fine, but testing it on Xiaomi, Asus phones( modified android os phones) throws an exception.
Error inflating class android.support.design.widget.NavigationView
I tried every solution given to this question on stackoverflow, but the error message still exists.
actvity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:itemTextColor="?android:textColorPrimary"
app:menu="#menu/activity_main_drawer"/>
</android.support.v4.widget.DrawerLayout>
build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.image"
minSdkVersion 15
targetSdkVersion 21
versionCode 10
versionName "5.11.10"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
}
apply plugin: 'com.google.gms.google-services'
logs
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.image/com.image.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
at android.app.ActivityThread.access$800(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:699)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.image.MainActivity.onCreate(MainActivity.java:46)
at android.app.Activity.performCreate(Activity.java:5245)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249 at android.app.ActivityThread.access$800(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5052)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:597)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:699) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:400) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.image.MainActivity.onCreate(MainActivity.java:46) 
at android.app.Activity.performCreate(Activity.java:5245) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249
at android.app.ActivityThread.access$800(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5052) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020050
at android.content.res.Resources.getValue(Resources.java:1133)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:285)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems(NavigationMenuPresenter.java:475)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.update(NavigationMenuPresenter.java:436)
at android.support.design.internal.NavigationMenuPresenter.updateMenuView(NavigationMenuPresenter.java:112)
at android.support.design.widget.NavigationView.inflateMenu(NavigationView.java:241)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:169)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:95)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:597) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:699) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:400) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.image.MainActivity.onCreate(MainActivity.java:46) 
at android.app.Activity.performCreate(Activity.java:5245) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249
at android.app.ActivityThread.access$800(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5052) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
i tried all the possible solutions, still i am facing issue only in Xiaomi, Asus phones only.
check your navigation view by removing one of these and check your code is working or not
app:headerLayout="#layout/nav_header"
app:menu="#menu/drawer"
if your logcat says cause by resourcenotfoundexception with your above error. issue may be with a icon file/resource file in drawers. if it coming from menu/drawer try changing icons and add icons to drawer folder and to drawer-v21. hope this helps
If this is due to proguard or in signed apk then you resove it by adding below line in you proguard-rule file.
-keep class org.xmlpull.v1.** { *; }

Resources$NotFoundException while using support-vector-drawable

I have a problem with support-vector-drawable library. When I'm testing my app on pre Lollipop devices application crashes. I found it was caused by using vector drawables and I thought support-vector-drawable will solve it. Unfortunately I can't make it work.
My applicaion build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "pl.testname"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:support-vector-drawable:23.2.1'
// androidannotations
apt "org.androidannotations:androidannotations:4.0.0"
compile "org.androidannotations:androidannotations-api:4.0.0"
// retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
Layout file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.MainActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/ic_menu_settings"/>
(...)
</RelativeLayout>
v21\ic_menu_settings.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
</vector>
Logcat
Process: pl.testname, PID: 309
java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.testname/pl.testname.activities.MainActivity_}: android.view.InflateException: Binary XML file line #11: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at pl.testname.fragments.ProductsFragment_.onCreateView(ProductsFragment_.java:58)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
at android.app.ActivityThread.access$800(ActivityThread.java:135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5001) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f02005b
at android.content.res.Resources.getValue(Resources.java:1123)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:285)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:65)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:172)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at pl.testname.fragments.ProductsFragment_.onCreateView(ProductsFragment_.java:58) 
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) 
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602) 
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 
at android.app.Activity.performStart(Activity.java:5241) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
at android.app.ActivityThread.access$800(ActivityThread.java:135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5001) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
at dalvik.system.NativeStart.main(Native Method) 
Using Android Studio 2.1 Preview 5 with Gradle 2.1.0-alpha5.
Any ideas?
Restart android studio and your problem will solve .....
if it will not solve than put ic_menu_settings.xml file into drawable folder
Changing the locations helped me: I had my vector-drawables in drawable-anydpi/ - this produces this crash - when i move the drawables to drawable/ it works fine.

External libraries not supporting

I am using some external libraries in my project. Earlier was working fine, but now it has stopped working.
It is showing error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.aguai.medieazy/app.aguai.medieazy.activities.MyOrders}: android.view.InflateException: Binary XML file line #13: Error inflating class it.neokree.materialtabs.MaterialTabHost
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class it.neokree.materialtabs.MaterialTabHost
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
at app.aguai.medieazy.activities.MyOrders.onCreate(MyOrders.java:32)
at android.app.Activity.performCreate(Activity.java:5275)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5299) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) 
at app.aguai.medieazy.activities.MyOrders.onCreate(MyOrders.java:32) 
at android.app.Activity.performCreate(Activity.java:5275) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5299) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NoClassDefFoundError: it.neokree.materialtabs.R$styleable
at it.neokree.materialtabs.MaterialTabHost.<init>(MaterialTabHost.java:71)
at it.neokree.materialtabs.MaterialTabHost.<init>(MaterialTabHost.java:57)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) 
at app.aguai.medieazy.activities.MyOrders.onCreate(MyOrders.java:32) 
at android.app.Activity.performCreate(Activity.java:5275) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5299) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
at dalvik.system.NativeStart.main(Native Method) 
The error line is thesetContentView(R.layout,MYLAYOUT) line only.
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "app.aguai.medieazy"
minSdkVersion 15
targetSdkVersion 22
versionCode 25
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/achartengine-1.0.0.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/FlurryAnalytics-5.5.0.jar')
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'it.neokree:MaterialTabs:0.11'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:design:22.2.1'
compile 'com.github.blackfizz:eazegraph:1.2.5l#aar'
compile 'com.appvirality:AppviralityUI:1.1.18+'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.nineoldandroids:library:2.4.0'
/*compile 'com.moengage:moe-android-sdk:5.3.27'*/
compile project(':gestureimageview')
/* compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'*/
}
The material-tabs xml code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_my_orders"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/theme"
/>
<it.neokree.materialtabs.MaterialTabHost
android:id="#+id/tabHost"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:layout_below="#+id/toolbar_my_orders"
app:primaryColor="#color/theme"
app:accentColor="#ffffff" />
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/tabHost" />
</RelativeLayout>
I am not able to find out what went wrong.
I figured out the reason, but I still don't understand it.
Earlier I was using compile 'com.google.android.gms:play-services:8.1.0'
then I update the google-play-services to compile 'com.google.android.gms:play-services:8.3.0'
So this change from 8.1 to 8.3 was causing problem.
I changed it back to 8.3, and it started working again.
Thanks a lot all of you.. I really appreciate the help.
Try adding compile project(':gifview') in your graddle file and check for correct package name in layout XML.
Caused by: java.lang.NoClassDefFoundError: it.neokree.materialtabs.R$styleable
try to follow the instructions MaterialTabs

Categories

Resources