[java] strange error in my Animation Drawable

A strange error when trying to start Activity.

i think the error in my Animation Drawable

LogCat:

    12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main     12-31 06:37:45.138: E/AndroidRuntime(922): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MalekAlrwily.BasicVaccinations/com.MalekAlrwily.BasicVaccinations.Main}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.access$600(ActivityThread.java:141)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.os.Handler.dispatchMessage(Handler.java:99)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.os.Looper.loop(Looper.java:137)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.main(ActivityThread.java:5103)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Method.invokeNative(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Method.invoke(Method.java:525)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)     12-31 06:37:45.138: E/AndroidRuntime(922):  at dalvik.system.NativeStart.main(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createView(LayoutInflater.java:620)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:469)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Activity.setContentView(Activity.java:1895)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.MalekAlrwily.BasicVaccinations.Main.onCreate(Main.java:15)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Activity.performCreate(Activity.java:5133)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)     12-31 06:37:45.138: E/AndroidRuntime(922):  ... 11 more     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: java.lang.reflect.InvocationTargetException     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Constructor.constructNative(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createView(LayoutInflater.java:594) 12-31 06:37:45.138: E/AndroidRuntime(922):  ... 23 more     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: java.lang.OutOfMemoryError     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:503)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:356)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:800)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.loadDrawable(Resources.java:2105)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.getDrawable(Resources.java:695)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:282)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:901)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.loadDrawable(Resources.java:2087)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.View.<init>(View.java:3364)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.View.<init>(View.java:3293)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.ViewGroup.<init>(ViewGroup.java:453)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:242)     12-31 06:37:45.138: E/AndroidRuntime(922):  ... 26 more 

XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/button1" android:layout_centerHorizontal="true" android:background="@drawable/animation" android:gravity="center_horizontal" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Main" >      <ImageButton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         android:layout_centerHorizontal="true"         android:background="@android:color/transparent"         android:onClick="onClick"         android:src="@drawable/next" />  </RelativeLayout> 

AnimationDrawable:

<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" >     <item  android:drawable="@drawable/begin1" android:duration="3000" />     <item  android:drawable="@drawable/begin2" android:duration="3000" />     <item  android:drawable="@drawable/begin3" android:duration="3000" />     <item  android:drawable="@drawable/begin4" android:duration="3000" />     <item  android:drawable="@drawable/begin5" android:duration="3000" />     <item  android:drawable="@drawable/begin6" android:duration="3000" />     <item  android:drawable="@drawable/begin7" android:duration="3000" />     <item  android:drawable="@drawable/begin8" android:duration="3000" />     <item  android:drawable="@drawable/begin9" android:duration="3000" /> </animation-list> 

This question is related to java android xml eclipse logcat

The answer is


Looks like whatever is in your Animation Drawable definition is too much memory to decode and sequence. The idea is that it loads up all the items and make them in an array and swaps them in and out of the scene according to the timing specified for each frame.

If this all can't fit into memory, it's probably better to either do this on your own with some sort of handler or better yet just encode a movie with the specified frames at the corresponding images and play the animation through a video codec.


Questions with java tag:

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error Instantiating a generic type When to create variables (memory management) java doesn't run if structure inside of onclick listener String method cannot be found in a main class method Are all Spring Framework Java Configuration injection examples buggy? Calling another method java GUI I need to know how to get my program to output the word i typed in and also the new rearranged word using a 2D array Java and unlimited decimal places? Read input from a JOptionPane.showInputDialog box Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable Two Page Login with Spring Security 3.2.x Hadoop MapReduce: Strange Result when Storing Previous Value in Memory in a Reduce Class (Java) Got a NumberFormatException while trying to parse a text file for objects Best way for storing Java application name and version properties Call japplet from jframe FragmentActivity to Fragment Comparing two joda DateTime instances Maven dependencies are failing with a 501 error IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Why am I getting Unknown error in line 1 of pom.xml? Gradle: Could not determine java version from '11.0.2' Error: Java: invalid target release: 11 - IntelliJ IDEA Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Why is 2 * (i * i) faster than 2 * i * i in Java? must declare a named package eclipse because this compilation unit is associated to the named module How do I install Java on Mac OSX allowing version switching? How to install JDK 11 under Ubuntu? Java 11 package javax.xml.bind does not exist IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Difference between OpenJDK and Adoptium/AdoptOpenJDK OpenJDK8 for windows How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Find the smallest positive integer that does not occur in a given sequence Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 How to uninstall Eclipse? Failed to resolve: com.google.firebase:firebase-core:16.0.1 How to resolve Unable to load authentication plugin 'caching_sha2_password' issue

Questions with android tag:

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8? "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' GoogleMaps API KEY for testing Can I use library that used android support with Androidx projects. How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Android Material and appcompat Manifest merger failed Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 How to format DateTime in Flutter , How to get current time in flutter? How to change package name in flutter? Failed to resolve: com.android.support:appcompat-v7:28.0 What is AndroidX? Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve FirebaseInstanceIdService is deprecated installation app blocked by play protect Handling back button in Android Navigation Component Android design support library for API 28 (P) not working Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Install Android App Bundle on device Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. How to develop Android app completely using python? Invoke-customs are only supported starting with android 0 --min-api 26 Flutter.io Android License Status Unknown How to open Android Device Monitor in latest Android Studio 3.1 Default interface methods are only supported starting with Android N How can I change the app display name build with Flutter? Error:(9, 5) error: resource android:attr/dialogCornerRadius not found error: resource android:attr/fontVariationSettings not found Flutter does not find android sdk Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior flutter run: No connected devices Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

Questions with xml tag:

strange error in my Animation Drawable How do I POST XML data to a webservice with Postman? PHP XML Extension: Not installed How to add a Hint in spinner in XML Generating Request/Response XML from a WSDL Manifest Merger failed with multiple errors in Android Studio How to set menu to Toolbar in Android How to add colored border on cardview? Android: ScrollView vs NestedScrollView WARNING: Exception encountered during context initialization - cancelling refresh attempt Changing text color of menu item in navigation drawer PHP: Call to undefined function: simplexml_load_string() Toolbar overlapping below status bar How do I get HTTP Request body content in Laravel? How to convert an XML file to nice pandas dataframe? XPath: Get parent node from child node Android: remove left margin from actionbar's custom layout How to create a floating action button (FAB) in android, using AppCompat v21? Convert Java object to XML string The following classes could not be instantiated: - android.support.v7.widget.Toolbar How to change line color in EditText How do I get a button to open another activity? How to create XML file with specific structure in Java SEVERE: Unable to create initial connections of pool - tomcat 7 with context.xml file ImageView in circular through xml Concatenate multiple node values in xpath no suitable HttpMessageConverter found for response type insert data into database using servlet and jsp in eclipse XSL if: test with multiple test conditions Very simple log4j2 XML configuration file using Console and File appender execute shell command from android Intent from Fragment to Activity ImageView rounded corners android.content.res.Resources$NotFoundException: String resource ID #0x0 Converting JSON to XML in Java Error: The processing instruction target matching "[xX][mM][lL]" is not allowed specifying goal in pom.xml UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 7: ordinal not in range(128) Differences between CHMOD 755 vs 750 permissions set The specified child already has a parent. You must call removeView() on the child's parent first How to reference a local XML Schema file correctly? How to query for Xml values and attributes from table in SQL Server? Adding custom radio buttons in android jquery.ajax Access-Control-Allow-Origin How to consume a SOAP web service in Java Send XML data to webservice using php curl How to iterate through XML in Powershell? Python Requests package: Handling xml response Write in body request with HttpClient Android getting value from selected radiobutton

Questions with eclipse tag:

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start What does 'Unsupported major.minor version 52.0' mean, and how do I fix it? m2e error in MavenArchiver.getManifest() How to use Tomcat 8.5.x and TomEE 7.x with Eclipse? The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files Setting the correct PATH for Eclipse java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries. spark Eclipse on windows 7 Eclipse not recognizing JVM 1.8 Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)? Can't import org.apache.http.HttpResponse in Android Studio web.xml is missing and <failOnMissingWebXml> is set to true Eclipse: How to install a plugin manually? How to solve maven 2.6 resource plugin dependency? Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse? Could not load the Tomcat server configuration "Multiple definition", "first defined here" errors Error loading the SDK when Eclipse starts org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start Spring Boot Program cannot find main class Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved How do I add a resources folder to my Java project in Eclipse Android Studio shortcuts like Eclipse Where can I download Eclipse Android bundle? Eclipse: Java was started but returned error code=13 Eclipse - Installing a new JRE (Java SE 8 1.8.0) Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources Eclipse error "Could not find or load main class" Eclipse Java error: This selection cannot be launched and there are no recent launches Cannot create Maven Project in eclipse Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 This compilation unit is not on the build path of a Java project Access restriction: The type 'Application' is not API (restriction on required library rt.jar) How to configure Glassfish Server in Eclipse manually The Import android.support.v7 cannot be resolved Why won't eclipse switch the compiler to Java 8? Can't fix Unsupported major.minor version 52.0 even after fixing compatibility There are No resources that can be added or removed from the server Error launching Eclipse 4.4 "Version 1.6.0_65 of the JVM is not suitable for this product." Using android.support.v7.widget.CardView in my project (Eclipse) Update Eclipse with Android development tools v. 23

Questions with logcat tag:

strange error in my Animation Drawable Android Studio - ADB Error - "...device unauthorized. Please check the confirmation dialog on your device." Couldn't load memtrack module Logcat Error sendUserActionEvent() is null Android studio logcat nothing to show Restore LogCat window within Android Studio error opening trace file: No such file or directory (2) Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one? How to filter Android logcat by application? Filter output in logcat by tagname The application has stopped unexpectedly: How to Debug? How to empty (clear) the logcat buffer in Android How to enable LogCat/Console in Eclipse for Android? Android: How can I print a variable on eclipse console? How do I write outputs to the Log in Android? Why doesn't logcat show anything in my Android?