asked    Tina     2018-07-05       android       281 view        1 Answer

[SOLVED] Application running on AVD for API 28 but not API 24

My application runs fine in AVD Just like the image below AVD for API 28 Running Result

it shows up this image on my phone same as for AVD which is lesser then API 28

this is the log when the app is on AVD which has API 24 instead of 28

07-05 07:25:16.856 7663-7663/? I/art: Not late-enabling -Xcheck:jni (already on)
07-05 07:25:16.857 7663-7663/? W/art: Unexpected CPU variant for X86 using defaults: x86_64
07-05 07:25:16.985 7663-7663/com.example.rex.quadtrorun W/System: ClassLoader referenced unknown path: /data/app/com.example.rex.quadtrorun-2/lib/x86_64
07-05 07:25:17.130 7663-7663/com.example.rex.quadtrorun W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-05 07:25:17.154 7663-7663/com.example.rex.quadtrorun I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
        at void android.support.v4.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2340)
        at void android.support.v7.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
        at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
        at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
        at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
        at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
        at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
        at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
        at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
07-05 07:25:17.155 7663-7663/com.example.rex.quadtrorun I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
        at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
        at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
        at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:605)
        at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:516)
        at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:464)
        at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
        at void com.example.rex.quadtrorun.MainPage.onCreate(android.os.Bundle) (MainPage.java:67)
        at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
        at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
        at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
        at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
        at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
        at void android.os.Looper.loop() (Looper.java:154)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
        at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
        at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.rex.quadtrorun-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.rex.quadtrorun-2/lib/x86_64, /system/lib64, /vendor/lib64]]
        at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
07-05 07:25:17.156 7663-7663/com.example.rex.quadtrorun I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
        at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
        at void android.support.v4.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2340)
        at void android.support.v7.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
        at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
        at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
        at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
        at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
        at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
        at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
        at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
        at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
        at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
        at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
        at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:605)
        at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:516)
        at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:464)
        at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
        at void com.example.rex.quadtrorun.MainPage.onCreate(android.os.Bundle) (MainPage.java:67)
        at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
        at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
        at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
        at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
        at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
        at void android.os.Looper.loop() (Looper.java:154)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
        at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
07-05 07:25:17.157 7663-7663/com.example.rex.quadtrorun I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
07-05 07:25:18.974 7663-7722/com.example.rex.quadtrorun I/OpenGLRenderer: Initialized EGL, version 1.4
07-05 07:25:18.974 7663-7722/com.example.rex.quadtrorun D/OpenGLRenderer: Swap behavior 1
07-05 07:25:18.975 7663-7722/com.example.rex.quadtrorun W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
07-05 07:25:18.975 7663-7722/com.example.rex.quadtrorun D/OpenGLRenderer: Swap behavior 0
07-05 07:25:19.036 7663-7722/com.example.rex.quadtrorun D/EGL_emulation: eglCreateContext: 0x7fb314e40320: maj 2 min 0 rcv 2
07-05 07:25:19.103 7663-7722/com.example.rex.quadtrorun D/EGL_emulation: eglMakeCurrent: 0x7fb314e40320: ver 2 0 (tinfo 0x7fb314e0c300)
07-05 07:25:19.186 7663-7663/com.example.rex.quadtrorun D/AndroidRuntime: Shutting down VM
07-05 07:25:19.467 7663-7663/com.example.rex.quadtrorun E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.rex.quadtrorun, PID: 7663
    java.lang.RuntimeException: Canvas: trying to draw too large(311498880bytes) bitmap.
        at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260)
        at android.graphics.Canvas.drawBitmap(Canvas.java:1415)
        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
        at android.view.View.getDrawableRenderNode(View.java:17314)
        at android.view.View.drawBackground(View.java:17250)
        at android.view.View.draw(View.java:17062)
        at android.view.View.updateDisplayListIfDirty(View.java:16053)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1966)
        at android.view.View.updateDisplayListIfDirty(View.java:16048)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.view.View.updateDisplayListIfDirty(View.java:16048)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.view.View.updateDisplayListIfDirty(View.java:16048)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.view.View.updateDisplayListIfDirty(View.java:16048)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.view.View.updateDisplayListIfDirty(View.java:16048)
        at android.view.View.draw(View.java:16837)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
        at android.view.View.draw(View.java:17074)
        at com.android.internal.policy.DecorView.draw(DecorView.java:751)
        at android.view.View.updateDisplayListIfDirty(View.java:16053)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:656)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:662)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:770)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2796)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2604)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2211)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
        at android.view.Choreographer.doCallbacks(Choreographer.java:683)
        at android.view.Choreographer.doFrame(Choreographer.java:619)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

PS: I'm new to this android studio and sorry for any misleading question

  1 Answer  

        answered    Rachel     2018-07-05      

As I see from logs

You are using API that is available only from API 28 and above. View.OnUnhandledKeyEventListener that has been added in API 28.

That is why it crashes on devices lower than 28. You can use

if (Build.VERSION.SDK_INT >= 28) {
   // Call your new API method
}

For more please have a look at: Support different platform versions.





Your Answer





 2018-07-05         Georgia

How to download pdf file in laravel 5.6?

I have stored my pdf file in files folder inside public folder. Now, i have a "Download" button inside resources/views/admin/view_data.blade.phpHow to download the pdf file when i click the download button?? Try this.When you click on the button call a route and a method then use this code. You can change directory path.public function getDownload(){ //PDF file is stored under project/public/download/info.pdf $file= public_path(). "/download/info.pdf"; $headers = array( 'Content-Type: application/pdf', ); return Response::download($file, 'filename.p...
 php                     1 answers                     72 view
 2018-07-05         Ira

Cant Store Images to public storage (LARAVEL)

Good day.I have problem why I cant store the image to the public storage.when i was in localhost the function is working. however when i put in the host it shows the image cant move to the public storage.what is the problem to that? Thanks I hope you will help me to solved this..This my controller:$content_image = $request->input('content_assets');$file_upload = $request->file('content_assets');if($request->hasFile('content_assets')){ $request->validate([ 'content_assets' => 'required|mimes:jpg,jpeg,png', ]); $x = $request->content_asset...
 laravel                     2 answers                     73 view
 2018-07-05         Poppy

Laravel whereIn() acting like orWhereIn()

There are 3 tables:mealstagsmeal_tagI want to get all meals that have all of the tags from an url query.For example: .../api/query?tags=1,2,3In this example I want to fetch all meals that have tag1 AND tag2 AND tag3,but my query returns meals that have tag1 OR tag2 OR tag3Here is my query: $query = Meal::query(); ... if ($request->has('tags')) { $inputTags = $request->query('tags'); $tags = explode(',', $inputTags); $query = $query->whereHas('tags', function($q) use ($tags) { $q->whereIn('tags.id', $tags); }); ...
 laravel-5                     1 answers                     72 view