Layout inflater error when loading app - android

I have a Galaxy Samsung tab 10.1" Model GT-P7510 OS Version 3.2. I tried to load app on it and it's giving me Layout inflater error. Why is this? Here is what logcat says:
android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:596)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:245)
at android.app.Activity.setContentView(Activity.java:1786)
at com.businessplan.BusinessPlannerActivity.onCreate(BusinessPlannerActivity.java:64)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1782)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
at android.app.ActivityThread.access$500(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1027)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
at android.view.LayoutInflater.createView(LayoutInflater.java:576)
android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020022 a=-1 r=0x7f020022}
at android.content.res.Resources.loadDrawable(Resources.java:1890)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:2462)
at android.view.ViewGroup.<init>(ViewGroup.java:365)
at android.widget.LinearLayout.<init>(LinearLayout.java:156)
at android.widget.LinearLayout.<init>(LinearLayout.java:152)

Probably you have an error in the layout file called here:
android.app.Activity.setContentView(Activity.java:1786) at com.businessplan.BusinessPlannerActivity.onCreate(BusinessPlannerActivity.java:64) at
Please check it yourself, or post it here.

I removed Gen folder and then again clean and build project and the error has gone.

Same, error went away after a clean project and do a rebuild.

Related

Missing drawables at runtime

Problem:
My App is missing resources at runtime.
One activity just get killed at startup. (error: color 0x2 could not get converted)
The other activity shows a screen with standard graphics instead of the included ones.
What I did before:
I'm still using Eclipse ADT and wanted to give Android Studio a try.
I already uninstall it to get rid of the runtime issue without success.
Any suggestions?
EDIT:
I think there is a general compiling error as there where no errors in this parts before.
Code 1:
AnimationUtils.loadAnimation(this.context, android.R.anim.fade_in)
Stacktrace 1:
Converting to int: TypedValue{t=0x3/d=0x21b "res/drawable/btn_default.xml" a=1 r=0x1080004}
java.lang.NumberFormatException: Invalid int: "res/drawable/btn_default.xml"
at java.lang.Integer.invalidInt(Integer.java:137)
Converting to int: TypedValue{t=0x3/d=0x21b "res/drawable/btn_default.xml" a=1 r=0x1080004}
at java.lang.Integer.parse(Integer.java:374)
at java.lang.Integer.parseInt(Integer.java:365)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:255)
at android.view.animation.Animation.<init>(Animation.java:246)
at android.view.animation.AlphaAnimation.<init>(AlphaAnimation.java:40)
at java.lang.NumberFormatException: Invalid int: "res/drawable/btn_default.xml"
at java.lang.Integer.invalidInt(Integer.java:137)
at java.lang.Integer.parse(Integer.java:374)
at java.lang.Integer.parseInt(Integer.java:365)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:255)
at android.view.animation.Animation.<init>(Animation.java:246)
at android.view.animation.AlphaAnimation.<init>(AlphaAnimation.java:40)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:116)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:91)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:116)
at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:72)
...
Code 2 (MY_activity.java:47):
setContentView(R.layout.MY_activity);
Stacktrace 2:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.app/my.app.activity}: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
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.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3163)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3223)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:312)
at android.app.Activity.setContentView(Activity.java:1901)
at my.app.MY_activity.onCreate(MY_activity.java:47)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
... 11 more
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)
... 25 more
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.TextView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
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 com.android.internal.widget.ActionBarView.initTitle(ActionBarView.java:831)
at com.android.internal.widget.ActionBarView.setDisplayOptions(ActionBarView.java:632)
at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:266)
... 28 more
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)
... 38 more
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
at android.content.res.TypedArray.getColor(TypedArray.java:326)
at android.widget.TextView.<init>(TextView.java:640)
at android.widget.TextView.<init>(TextView.java:579)
... 41 more
I implemented the new material design like this:
Theme.Material.Light.NoActionBar
The correct form (after including appcompat v7):
Theme.AppCompat.Light.NoActionBar

Android 4.0 Issue with google plus login

I have google plus login working fine on devices > 4.1 but some devices cause a crash on 4.0
My best guess is that there is a issue(or it is outdated) with google play services installed on the device.
This is the error I get:
java.lang.RuntimeException: Unable to start activity ComponentInfo{me.frankly/me.frankly.view.activity.NewLoginActivity}: android.view.InflateException: Binary XML file line #103: Error inflating class com.google.android.gms.common.SignInButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: android.view.InflateException: Binary XML file line #103: Error inflating class com.google.android.gms.common.SignInButton
at android.view.LayoutInflater.createView(LayoutInflater.java:608)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
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:254)
at android.app.Activity.setContentView(Activity.java:1837)
at me.frankly.view.activity.NewLoginActivity.onCreate(NewLoginActivity.java:112)
at android.app.Activity.performCreate(Activity.java:4479)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:588)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
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:254)
at android.app.Activity.setContentView(Activity.java:1837)
at me.frankly.view.activity.NewLoginActivity.onCreate(NewLoginActivity.java:112)
at android.app.Activity.performCreate(Activity.java:4479)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$drawable
at com.google.android.gms.common.internal.q.b()
at com.google.android.gms.common.internal.q.a()
at com.google.android.gms.common.SignInButton.a()
at com.google.android.gms.common.SignInButton.G()
at com.google.android.gms.common.SignInButton.setStyle()
at com.google.android.gms.common.SignInButton.<init>()
at com.google.android.gms.common.SignInButton.<init>()
at java.lang.reflect.Constructor.constructNative(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:588)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:744)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
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:254)
at android.app.Activity.setContentView(Activity.java:1837)
at me.frankly.view.activity.NewLoginActivity.onCreate(NewLoginActivity.java:112)
at android.app.Activity.performCreate(Activity.java:4479)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(NativeStart.java)
Going through your stack traces I noticed
Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$drawable
That leads me to assume that you added the jar for the Play Services SDK but didn't add the Android library project and that is why it could not be found. It may also be possibility that you may be using an outdated version of the Play Service SDK.
I suggest viewing CommonsWare solution by clicking here.

How to resolve a stack trace error

I have an Android app which has a minimum SDK at 2.1 and I am getting the following stack trace in the developer console:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.versions.MyPhone}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2705)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2721)
at android.app.ActivityThread.access$2300(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4669)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
at android.app.Activity.setContentView(Activity.java:1656)
at com.versions.MyPhone.onCreate(MyPhone.java:49)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.LinearLayout.<init>(LinearLayout.java:115)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 21 more
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1885)
at android.view.View.<init>(View.java:1834)
at android.view.ViewGroup.<init>(ViewGroup.java:285)
The error doesn't happen in the newer devices with an updated Os.
Please help me resolve the issue or point me in the right direction.
Based on the java.lang.OutOfMemoryError: bitmap size exceeds VM budget message in the stack trace, it appears that one of the images in the view being opened in your onCreate() is too large.
Here's a page with some guidance. The main idea is to load a scaled down version of the image. I've found it best to also scale down (resolution, color-depth, etc.) the actual image file to maximize loading speed.

AsyncHttpClient ConnectException with no error message

I have a problem but could not be found any solution, I use AsyncHttpClient in https://github.com/AsyncHttpClient/async-http-client, I can run my code in API level 10, but not in API level 17. I am getting this error:
11-13 14:36:47.987 13294-13294/com.modilisim.antalyaticaretborsasi E/com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment﹕ error occurred while getting daily bultenler
java.util.concurrent.ExecutionException: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:328)
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:106)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1056)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:880)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:521)
at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:238)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:126)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:102)
at com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment.onCreateView(ScrollingBultenlerFragment.java:51)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
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.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.modilisim.antalyaticaretborsasi.view.fragment.MainFragment.onCreateView(MainFragment.java:42)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
at android.app.Activity.performStart(Activity.java:5114)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5195)
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:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyConnectListener.operationCom
I am doing a project in a company so I had to hide the urls in the error code above, but urls are working, they are not problem. Any help appreciated, thanks.
I learned that this AsyncHttpClient library is not for Android, so it is not working properly on all versions of Android. There is a library parallel to this library for Android: http://loopj.com/android-async-http/

error inflating class and memory issues

I have an app that has 2 main layouts and does use alot of pictures (16). The app works fine but it seems after going between layouts a few times it crashes and I believe it is because it is running out of memory. Im not sure how to fix this besides making the pictures smaller.. any suggestions?
06-14 14:28:10.543584-616/? E/NotificationService: Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=nullnull defaults=0x0 flags=0x62 kind=[null])
06-14 14:28:15.678 19572-19572/?E/dalvikvm-heap: Out of memory on a 2764816-byte allocation.
06-14 14:28:15.698 19572-19572/?E/dalvikvm: Extra info: Footprint=63559KB, Allowed Footprint=65543KB, Trimmed=7916KB
06-14 14:28:15.718 19572-19572/?E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nick.simplequiz.plus/com.nick.simplequiz.plus.saveImage}: android.view.InflateException: Binary XML file line #403: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2351)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$600(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5454)
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:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #403: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
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 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:363)
at android.app.Activity.setContentView(Activity.java:1912)
at com.nick.simplequiz.plus.saveImage.onCreate(saveImage.java:33)
at android.app.Activity.performCreate(Activity.java:5066)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
... 11 more
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)
... 26 more
Caused by: java.lang.OutOfMemoryError: (Heap Size=65543KB, Allocated=57586KB)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:626)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:473)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
at android.content.res.Resources.loadDrawable(Resources.java:1959)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:120)
at android.widget.ImageView.<init>(ImageView.java:110)
... 29 more
06-14 14:28:15.728 584-595/?E/EmbeddedLogger: App crashed! Process: com.nick.simplequiz.plus
06-14 14:28:15.728 584-595/?E/EmbeddedLogger: App crashed! Package: com.nick.simplequiz.plus v6 (1.0)
06-14 14:28:15.728 584-595/?E/EmbeddedLogger: Application Label: Name the plane plus!
I ran into a similar issue before. I believe the
issue is due to recreating the bitmap every time
you start the activity. Here's a snippet of what
i did to get rid of the issue.
Bitmap d;
private void setImage(String path){
if(d != null){
d.recycle();
}
d = BitmapFactory.decodeFile(path);
if(d != null){
profilePicture.setImageDrawable(new BitmapDrawable(d));
}
}

Categories

Resources