Unfortunately the app stopped problem with imageview Android kit kat (API 19)

0

Good morning coders. I tell you what happens to me.

I'm making an app for android, native, but when trying to insert an imageview (as indicated by the official documentation link api level 16) ... the app works on devices lollipop 5.0 and up (api 20).

However, in api 19 (Android kitkat 4.4.2) the application stops.

THE ONLY THING THAT HAS THE VIEW IS AN IMAGEVIEW, NOTHING ELSE , nothing is programmed, only the activty, with the image view, I am inserting a PNG image of 90x90 pixels, there should be no problem some.

When I created the application I put it with the api 16, (the compatibility> 90.5% of the android devices)

here the code:

<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
     <ImageView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/logo"
         />
 </LinearLayout>

As I said, it's the only thing that has the activity, the app is cool, the funny thing is that with the other elements it works (TextView, Botton, editText, etc.), but an activity with a single imageview stops me , the app stops working.

I tried both in the emulator, and in my samsung galaxy tab 3.0 SMT-210 and nothing, in both stops.

here is the logcat report:

12-21 15:31:17.041 4007-4007/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: apps.nelingenieria.com.app, PID: 4007
    java.lang.RuntimeException: Unable to start activity ComponentInfo{apps.nelingenieria.com.app/apps.nelingenieria.com.app.LoginActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class ImageView
        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 #6: Error inflating class ImageView
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714)
        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 apps.nelingenieria.com.app.LoginActivity.onCreate(LoginActivity.java:11)
        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: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060056 a=-1 r=0x7f060056}
        at android.content.res.Resources.loadDrawable(Resources.java:2073)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
        at android.widget.ImageView.<init>(ImageView.java:129)
        at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:71)
        at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:67)
        at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:181)
        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:105)
        at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1035)
        at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
        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 apps.nelingenieria.com.app.LoginActivity.onCreate(LoginActivity.java:11) 
        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) 
12-21 15:31:17.041 1695-2156/system_process W/ActivityManager:   Force finishing activity apps.nelingenieria.com.app/.LoginActivity

I appreciate your help in advance for a possible solution ... I already tried putting this on the AndroidMainfest and it did not work android:largeHeap="true"

    
asked by arxzel 21.12.2018 в 21:39
source

2 answers

2

In this case the images you try to upload to your ImageView are Vector Drawables , therefore you must use the property app:srcCompat instead of android:src

<ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     app:srcCompat="@drawable/logo"
     />
    
answered by 21.12.2018 в 22:57
0

I found the solution in the next post after so much searching ...

link

It turns out that the drawable-24 folder is not available or does not exist in the old android APIs. The solution was to copy the image to be used in the drawable folder as well. and this problem is solved: D

    
answered by 21.12.2018 в 22:13