Android Studio Gradle API compatibility - android

I am writing an application in Android Studio. It compiles and works perfectly on Marshmallow, but when I try to execute it with a Jelly Bean emulator (API 16), it fails. I also tried to change the compileSdkVersion to 16 and consequently also change all the dependencies with older versions, but it still doesn't work. Can you help me?
This is the error:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.carlo.application/com.example.carlo.clashofschools.MainActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.carlo.clashofschools.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.carlo.clashofschools.MainActivity.onCreate(MainActivity.java:37) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02005a a=2 r=0x7f02005a}
at android.content.res.Resources.loadDrawable(Resources.java:1892)
at android.content.res.Resources.getDrawable(Resources.java:659)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:346)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:197)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:185)
at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems(NavigationMenuPresenter.java:505)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.update(NavigationMenuPresenter.java:446)
at android.support.design.internal.NavigationMenuPresenter.updateMenuView(NavigationMenuPresenter.java:112)
at android.support.design.widget.NavigationView.inflateMenu(NavigationView.java:248)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:171)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:97)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.carlo.clashofschools.MainActivity.onCreate(MainActivity.java:37) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
I suppose the problem is with the Gradle build settings. This is my app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.carlo.application"
minSdkVersion 15
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:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:gridlayout-v7:24.2.1'
}
and my project build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

The error message has a few critical lines in it:
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path)
...
at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
...
at android.support.design.widget.NavigationView.inflateMenu(NavigationView.java:248)
So this has nothing to do with gradle but with one of the icons you use in your NavigationView not being found. Double check that your icons are valid on API 16 (i.e., they are not only found in a drawable-v21 folder for instance).

Related

Glide & OkHttp for Android API 16 not working

I am developing Android App for API level 16 & above:
minSdkVersion 16, targetSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Dependencies:
implementation "com.github.bumptech.glide:glide:4.11.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
implementation "com.github.bumptech.glide:okhttp3-integration:4.11.0"
I am using Glide & as per this requirement it should work for (API level 14) or higher. OkHttp exception “Expected Android API level 21+ but was 29” is also fixed in 3.14.7. When I compile app it crashes with following Logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202)
at retrofit2.Retrofit$Builder.build(Retrofit.java:614)
at com.example.retrofitgliderecycler.MoviesRepository.getInstance(MoviesRepository.java:33)
at com.example.retrofitgliderecycler.MainActivity.onCreate(MainActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.VerifyError: okhttp3/internal/platform/Android10Platform
at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263) 
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229) 
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202) 
at retrofit2.Retrofit$Builder.build(Retrofit.java:614) 
at com.example.retrofitgliderecycler.MoviesRepository.getInstance(MoviesRepository.java:33) 
at com.example.retrofitgliderecycler.MainActivity.onCreate(MainActivity.java:40) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method)
You might wanna open an issue on okHttp as you're getting Caused by: java.lang.VerifyError: okhttp3/internal/platform/Android10Platform which seems to be the package fault, there is the same issue here

Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.mapbox.mapboxsdk.maps.MapView

Application throws a view.InflateException while opening MapBox, in API 19. This is the error:
12-06 11:59:22.057 2906-2906/com.example.sabith.doortracker E/UncaughtException: java.lang.RuntimeException: Unable to
start activity ComponentInfo{com.example.sabith.doortracker/com.example.sabith.doortracker.view.admin.WorkPolylineActivity}:
android.view.InflateException: Binary XML file line #0: Error inflating class com.mapbox.mapboxsdk.maps.MapView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
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:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.mapbox.mapboxsdk.maps.MapView
at android.view.LayoutInflater.createView(LayoutInflater.java:621)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.sabith.doortracker.view.admin.WorkPolylineActivity.onCreate(WorkPolylineActivity.java:71)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
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:5017) 
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:779) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
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:595)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) 
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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.example.sabith.doortracker.view.admin.WorkPolylineActivity.onCreate(WorkPolylineActivity.java:71) 
at android.app.Activity.performCreate(Activity.java:5231) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
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:5017) 
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:779) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.VerifyError: com/mapbox/mapboxsdk/maps/widgets/MyLocationView
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:595)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
at android.view.LayoutInflater.inflate(LayoutInflater.java:462)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.mapbox.mapboxsdk.maps.MapView.initialise(MapView.java:125)
at com.mapbox.mapboxsdk.maps.MapView.<init>(MapView.java:102)
build.gradle :
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.0#aar'
//Mapbox webkit Library
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.1#aar') {
transitive = true
}
layout.xml:
<RelativeLayout 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"
xmlns:mapbox="http://schemas.android.com/apk/res-auto">
<com.mapbox.mapboxsdk.maps.MapView
android:id="#+id/mapViewPolyline"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapbox_styleUrl="#string/mapbox_style_mapbox_streets"
mapbox:mapbox_cameraZoomMin="6"
mapbox:mapbox_uiRotateGestures="false"/>
</RelativeLayout>
But, application run smoothly on API greater than 19.
Please suggest a solution.
OP issue was fixed via https://github.com/mapbox/mapbox-gl-native/pull/10579 and it'll be available in the upcoming release 5.2.1.
In the meantime, you could test this out with the 5.3.0-SNAPSHOT build which includes the fix.
To use snapshots, you'd need to add the snapshots repo in the root build.gradle file:
allprojects {
repositories {
jcenter()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
}
In your app build.gradle you'd need to replace your current dependency with:
implementation(com.mapbox.mapboxsdk:mapbox-android-sdk:5.3.0-SNAPSHOT#aar) {
transitive = true
}
Hope that helps! Cheers!
For non-snapshot versions use :
repositories {
jcenter()
maven { url "http://oss.sonatype.org/content/repositories/" }
}

Android app unfortunately stopped caused by android:drawableBottom

I have a android.support.v7.widget.AppCompatButton in my layout XML. My app works correctly on Android SDK 21 but it, unfortunately, stopped in Android SDK 16 (my minSDKVersion in AndroidManifest.xml is 16).
My AppCompatButton is this:
<android.support.v7.widget.AppCompatButton
android:id="#+id/button_next"
android:layout_width="45dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical|start"
android:drawableBottom="#drawable/ic_navigate_next" />
and error is this:
11-07 22:20:36.774 3300-3300/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.app/com.myapp.app.Activity}: android.view.InflateException: Binary XML file line #97: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #97: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.virascience.app.SearchActivity.onCreate(SearchActivity.java:90)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096) 
at android.app.ActivityThread.access$600(ActivityThread.java:138) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:4787) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 
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:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.virascience.app.SearchActivity.onCreate(SearchActivity.java:90) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096) 
at android.app.ActivityThread.access$600(ActivityThread.java:138) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:4787) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_navigate_next.xml from drawable resource ID #0x7f02007d
at android.content.res.Resources.loadDrawable(Resources.java:1923)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.TextView.<init>(TextView.java:634)
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 java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.virascience.app.SearchActivity.onCreate(SearchActivity.java:90) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096) 
at android.app.ActivityThread.access$600(ActivityThread.java:138) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:4787) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:886)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822)
at android.content.res.Resources.loadDrawable(Resources.java:1920)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
at android.widget.TextView.<init>(TextView.java:634) 
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 java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.virascience.app.SearchActivity.onCreate(SearchActivity.java:90) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096) 
at android.app.ActivityThread.access$600(ActivityThread.java:138) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:4787) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 
at dalvik.system.NativeStart.main(Native Method) 
Why this problem occurs and How can resolve that?
you might have separated your drawable folders to based on version/screen_size
make sure your drawable exist for all versions or if you don't have one simply put a copy of it in your base "drawable" folder
android:drawableBottom="#drawable/ic_navigate_next"
ic_navigate_next must be in all drawable folders or one generic one in main drawable
see if it helps?
If your drawable is a vector drawable then that might be it.
See:
Here's [a link] (Is it possible to use VectorDrawable in Buttons and TextViews using android:DrawableRight?)!

ZBar Fatal Error

I'm a new user of this forum, and I have a little problem:
I'm trying to make an android app, which has to use the ZBar libs, and I've founded something on the web.
So, I've written my code, but when I try to execute it on the emulator (I use Android Studio 1.5.1), I receive the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.mirco.myapplication.BarcodeScanner.initControls(BarcodeScanner.java:50)
at com.example.mirco.myapplication.BarcodeScanner.onCreate(BarcodeScanner.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 793 could not load needed library 'libiconv.so' for 'libzbarjni.so' (load_library[1093]: Library 'libiconv.so' not found)
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at net.sourceforge.zbar.ImageScanner.<clinit>(Unknown Source)
at com.example.mirco.myapplication.BarcodeScanner.initControls(BarcodeScanner.java:50) 
at com.example.mirco.myapplication.BarcodeScanner.onCreate(BarcodeScanner.java:40) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
My dependencies:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/zbar.jar') }
I am using ZBar SDK 0.1

android support v4 library not supported in android 4.0 but working in 5.0?

The Drawer layout not supported in android 4.0 version and if android-support-v4.jar file adding then multiple dex file error occur.
I am facing this problem from last friday. Please help me.
xml
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--android:layout_below="#+id/topLay"
android:layout_above="#+id/menu_lay" -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<ListView
android:id="#+id/dList"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginBottom="40dp"
android:choiceMode="singleChoice"
android:divider="#color/menu_divider_color"
android:dividerHeight="#dimen/divider_ht"
android:background="#drawable/side_menu_bg"/>
<!-- android:layout_width="220dp" -->
</android.support.v4.widget.DrawerLayout>
gradle file
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':facebook')
compile files('libs/universal-image-loader-1.9.3.jar')
compile('com.twitter.sdk.android:twitter:1.3.1#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.0'
//for multiple dex library
compile files('libs/PdfViewer.jar')
compile project(':mupdflibrary')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2'
compile project(':gesture-imageview')
compile 'com.android.support:support-v4:23.1.1'
}
Error:
E/AndroidRuntime: FATAL EXCEPTION:
main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tatahousing/com.tatahousing.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v4.widget.DrawerLayout at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v4.widget.DrawerLayout
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 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
at android.app.Activity.setContentView(Activity.java:1895)
at com.tatahousing.MainActivity.onCreate(MainActivity.java:227)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
at android.app.ActivityThread.access$600(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5103) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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:417)
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 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267) 
at android.app.Activity.setContentView(Activity.java:1895) 
at com.tatahousing.MainActivity.onCreate(MainActivity.java:227) 
at android.app.Activity.performCreate(Activity.java:5133) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
at android.app.ActivityThread.access$600(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5103) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NoClassDefFoundError: android.support.v4.view.AccessibilityDelegateCompatIcs
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.newAccessiblityDelegateDefaultImpl(AccessibilityDelegateCompat.java:122)
at android.support.v4.view.AccessibilityDelegateCompat.<clinit>(AccessibilityDelegateCompat.java:302)
at android.support.v4.widget.DrawerLayout.<init>(DrawerLayout.java:175)
at android.support.v4.widget.DrawerLayout.<init>(DrawerLayout.java:347)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
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 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267) 
at android.app.Activity.setContentView(Activity.java:1895) 
at com.tatahousing.MainActivity.onCreate(MainActivity.java:227) 
at android.app.Activity.performCreate(Activity.java:5133) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
at android.app.ActivityThread.access$600(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5103) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
Add following dependency in your app gradle file and remove externa jar file.
compile 'com.android.support:support-v4:23.1.1'

Categories

Resources