How to solve Stack Overflow for Android - android

Help me please, who ever see this error below :
**04-24 23:24:21.012: I/dalvikvm(327): threadid=1: stack overflow on call to Ljava/lang/Class;.isPrimitive:Z**
04-24 23:24:21.012: I/dalvikvm(327): method requires 4+20+0=24 bytes, fp is 0x430c9314 (20 left)
04-24 23:24:21.012: I/dalvikvm(327): expanding stack end (0x430c9300 to 0x430c9000)
04-24 23:24:21.073: I/dalvikvm(327): Shrank stack (to 0x430c9300, curFrame is 0x430cbeb8)
04-24 23:24:21.073: D/AndroidRuntime(327): Shutting down VM
04-24 23:24:21.073: W/dalvikvm(327): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-24 23:24:21.512: D/dalvikvm(327): GC_FOR_MALLOC freed 4475 objects / 369040 bytes in 192ms
04-24 23:24:21.512: E/AndroidRuntime(327): FATAL EXCEPTION: main
04-24 23:24:21.512: E/AndroidRuntime(327): java.lang.StackOverflowError
04-24 23:24:21.512: E/AndroidRuntime(327): at java.lang.reflect.Array.newInstance(Array.java:473)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.SpannableStringBuilder.getSpans(SpannableStringBuilder.java:757)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.SpannableStringBuilder.sendSpanAdded(SpannableStringBuilder.java:902)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:611)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:514)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.Selection.setSelection(Selection.java:74)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.Selection.setSelection(Selection.java:85)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.text.method.ArrowKeyMovementMethod.initialize(ArrowKeyMovementMethod.java:497)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2676)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2556)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.EditText.setText(EditText.java:75)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2531)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC.setButton(TabletFC.java:236)
04-24 23:24:21.512: E/AndroidRuntime(327): at com.app.tabletfc.TabletFC$13.onTextChanged(TabletFC.java:191)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:2691)
04-24 23:24:21.512: E/AndroidRuntime(327): at android.widget.TextView.setText(TextView.java:25

Well it certainly looks like your onTextChanged handler is calling setButton, which in turn is calling setText, which is calling your onTextChanged handler again, leading to infinite recursion.
Um, don't do that.
It's hard to give more concrete advice without any more information on what you're trying to do or what your code looks like.

Related

Unable to understand log output in android app [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Here is my log output. I need your help determining where to begin to solve the issue:
If I execute the app in a device with version 4.4.2, no exception is thrown, but executing the app on a device with lower version, the app crashes..
12-05 11:34:50.716: E/AndroidRuntime(327): FATAL EXCEPTION: main
12-05 11:34:50.716: E/AndroidRuntime(327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.solinpromex.casajuventudtrescantos/com.solinpromex.casajuventudtrescantos.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.os.Looper.loop(Looper.java:123)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-05 11:34:50.716: E/AndroidRuntime(327): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 11:34:50.716: E/AndroidRuntime(327): at java.lang.reflect.Method.invoke(Method.java:507)
12-05 11:34:50.716: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-05 11:34:50.716: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-05 11:34:50.716: E/AndroidRuntime(327): at dalvik.system.NativeStart.main(Native Method)
12-05 11:34:50.716: E/AndroidRuntime(327): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
12-05 11:34:50.716: E/AndroidRuntime(327): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-05 11:34:50.716: E/AndroidRuntime(327): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.Activity.setContentView(Activity.java:1657)
12-05 11:34:50.716: E/AndroidRuntime(327): at com.solinpromex.casajuventudtrescantos.MainActivity.onCreate(MainActivity.java:28)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-05 11:34:50.716: E/AndroidRuntime(327): ... 11 more
12-05 11:34:50.716: E/AndroidRuntime(327): Caused by: java.lang.reflect.InvocationTargetException
12-05 11:34:50.716: E/AndroidRuntime(327): at java.lang.reflect.Constructor.constructNative(Native Method)
12-05 11:34:50.716: E/AndroidRuntime(327): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
12-05 11:34:50.716: E/AndroidRuntime(327): ... 22 more
12-05 11:34:50.716: E/AndroidRuntime(327): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.content.res.Resources.loadDrawable(Resources.java:1709)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.widget.ImageView.<init>(ImageView.java:118)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.widget.ImageView.<init>(ImageView.java:108)
12-05 11:34:50.716: E/AndroidRuntime(327): ... 25 more
12-05 11:34:50.726: W/ActivityManager(60): Force finishing
The reason is clear:
12-05 11:34:50.716: E/AndroidRuntime(327): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
Solution: try to use the drawable with smaller resolution.
You have run out of memory which caused a bunch of issues (cannot inflate the activity xml which causes the activity to not start since you get an exception in the onCreate method that is not handled)
12-05 11:34:50.716: E/AndroidRuntime(327): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.content.res.Resources.loadDrawable(Resources.java:1709)
12-05 11:34:50.716: E/AndroidRuntime(327): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
to fix it try loading a smaller size bitmap for in your imageview for lesser devices (pre 4.4.2)

App crashes in 2.2 but not in higher versions

I am using appcompat_v7 for actionbar compatability & android-support-v4.jar for fragment compatability, but my app crashes in 2.2.
Logcat
07-17 12:43:27.785: I/dalvikvm(327): Could not find method android.content.pm.PackageManager.getActivityLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
07-17 12:43:27.785: W/dalvikvm(327): VFY: unable to resolve virtual method 319: Landroid/content/pm/PackageManager;.getActivityLogo (Landroid/content/ComponentName;)Landroid/graphics/drawable/Drawable;
07-17 12:43:27.795: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x008b
07-17 12:43:27.795: I/dalvikvm(327): Could not find method android.content.pm.ApplicationInfo.loadLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
07-17 12:43:27.795: W/dalvikvm(327): VFY: unable to resolve virtual method 315: Landroid/content/pm/ApplicationInfo;.loadLogo (Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
07-17 12:43:27.795: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x0099
07-17 12:43:27.805: D/dalvikvm(327): VFY: dead code 0x008e-0092 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
07-17 12:43:27.805: D/dalvikvm(327): VFY: dead code 0x009c-00a0 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
07-17 12:43:28.055: I/dalvikvm(327): Could not find method com.example.indianconstitution.MainActivity.invalidateOptionsMenu, referenced from method com.example.indianconstitution.MainActivity$1.onDrawerClosed
07-17 12:43:28.055: W/dalvikvm(327): VFY: unable to resolve virtual method 8698: Lcom/example/indianconstitution/MainActivity;.invalidateOptionsMenu ()V
07-17 12:43:28.055: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x002d
07-17 12:43:28.055: D/dalvikvm(327): VFY: dead code 0x0030-0030 in Lcom/example/indianconstitution/MainActivity$1;.onDrawerClosed (Landroid/view/View;)V
07-17 12:43:28.065: I/dalvikvm(327): Could not find method com.example.indianconstitution.MainActivity.invalidateOptionsMenu, referenced from method com.example.indianconstitution.MainActivity$1.onDrawerOpened
07-17 12:43:28.065: W/dalvikvm(327): VFY: unable to resolve virtual method 8698: Lcom/example/indianconstitution/MainActivity;.invalidateOptionsMenu ()V
07-17 12:43:28.065: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x002d
07-17 12:43:28.065: D/dalvikvm(327): VFY: dead code 0x0030-0030 in Lcom/example/indianconstitution/MainActivity$1;.onDrawerOpened (Landroid/view/View;)V
07-17 12:43:28.215: D/AndroidRuntime(327): Shutting down VM
07-17 12:43:28.225: W/dalvikvm(327): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-17 12:43:28.254: E/AndroidRuntime(327): FATAL EXCEPTION: main
07-17 12:43:28.254: E/AndroidRuntime(327): android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
07-17 12:43:28.254: E/AndroidRuntime(327): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-17 12:43:28.254: E/AndroidRuntime(327): at com.example.indianconstitution.NavDrawerListAdapter.getView(NavDrawerListAdapter.java:44)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.ListView.makeAndAddView(ListView.java:1727)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.ListView.fillDown(ListView.java:652)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.ListView.fillFromTop(ListView.java:709)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.ListView.layoutChildren(ListView.java:1580)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.AbsListView.onLayout(AbsListView.java:1147)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:767)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.os.Looper.loop(Looper.java:123)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-17 12:43:28.254: E/AndroidRuntime(327): at java.lang.reflect.Method.invokeNative(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327): at java.lang.reflect.Method.invoke(Method.java:521)
07-17 12:43:28.254: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-17 12:43:28.254: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-17 12:43:28.254: E/AndroidRuntime(327): at dalvik.system.NativeStart.main(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327): Caused by: java.lang.reflect.InvocationTargetException
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.TextView.<init>(TextView.java:321)
07-17 12:43:28.254: E/AndroidRuntime(327): at java.lang.reflect.Constructor.constructNative(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
07-17 12:43:28.254: E/AndroidRuntime(327): ... 36 more
07-17 12:43:28.254: E/AndroidRuntime(327): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
07-17 12:43:28.254: E/AndroidRuntime(327): at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.view.View.<init>(View.java:2036)
07-17 12:43:28.254: E/AndroidRuntime(327): at android.widget.TextView.<init>(TextView.java:327)
07-17 12:43:28.254: E/AndroidRuntime(327): ... 40 more
07-17 12:43:28.355: D/dalvikvm(327): GC_FOR_MALLOC freed 3423 objects / 301120 bytes in 90ms
Any Idea why am I getting this error ?
How can it be solved ?
Thanks in advance
You are calling methods that does not exist in Android 2.2 (but do exist in later versions). Use Lint tool to check your code and fix it.

Android: Error when using QRGen lib to generate QR code

I am trying to generate QRCode image using QRGen library.
I have imported qrgen-1.0.jar file to my project.
I know this question is duplicate.
I have referred following code by this link
public Bitmap qrBitmapFromString(String qrText){
ByteArrayOutputStream out = QRCode.from(qrText).to(ImageType.PNG).withSize(300, 300).stream();
byte[] data = out.toByteArray();
Bitmap bmp = BitmapFactory.decodeByteArray (data,0,data.length, null);
return bmp;
}
But I am getting the following error.
04-24 11:48:57.138: E/AndroidRuntime(824): FATAL EXCEPTION: main
04-24 11:48:57.138: E/AndroidRuntime(824): java.lang.NoClassDefFoundError: net.glxn.qrgen.QRCode
04-24 11:48:57.138: E/AndroidRuntime(824): at com.example.barcodeexample.QRCodeGeneratorActivity.onCreate(QRCodeGeneratorActivity.java:34)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.Activity.performCreate(Activity.java:5008)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.os.Looper.loop(Looper.java:137)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-24 11:48:57.138: E/AndroidRuntime(824): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 11:48:57.138: E/AndroidRuntime(824): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 11:48:57.138: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-24 11:48:57.138: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-24 11:48:57.138: E/AndroidRuntime(824): at dalvik.system.NativeStart.main(Native Method)
I have imported
import net.glxn.qrgen.QRCode;
import net.glxn.qrgen.image.ImageType;
2.0-SNAPSHOT should solve this https://oss.sonatype.org/content/repositories/snapshots/net/glxn/qrgen/android/2.0-SNAPSHOT/
https://github.com/kenglxn/QRGen
Finally I found and following thing working well for me.
Right click on your project
Go into Build Path
Configure Build Path
Go to Order and Export
Check your OnBarcode library
Clean your project
Think this may help some one like me.
Thanks.

HoloEverywhere xml parsing error/Application crashing

For some reason, I'm getting this error when using HoloEverywhere. My application crashes on creation and my xml layouts are not displaying for below 3.0. Here is my xml error.
Failed to configure parser for C:\Users\Akhil\HoloEverywhere\hololib\res\color\secondary_text_holo_light.xml
Failed to configure parser for C:\Users\Akhil\HoloEverywhere\hololib\res\drawable\background_cache_hint_selector_holo_light.xml
Failed to configure parser for C:\Users\Akhil\HoloEverywhere\hololib\res\color\primary_text_holo_light.xml
Exception details are logged in Window > Show View > Error Log
And here is my logcat. which references an error on line 57 of my activity's onCreate. Line 57 inflates the xml file. This is only happening with HoloEverywhere. Please Help!
12-09 03:01:20.893: E/AndroidRuntime(327): FATAL EXCEPTION: main
12-09 03:01:20.893: E/AndroidRuntime(327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample/com.example.sample.CourseListActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.os.Handler.dispatchMessage(Handler.java:99)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.os.Looper.loop(Looper.java:123)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-09 03:01:20.893: E/AndroidRuntime(327): at java.lang.reflect.Method.invokeNative(Native Method)
12-09 03:01:20.893: E/AndroidRuntime(327): at java.lang.reflect.Method.invoke(Method.java:521)
12-09 03:01:20.893: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-09 03:01:20.893: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-09 03:01:20.893: E/AndroidRuntime(327): at dalvik.system.NativeStart.main(Native Method)
12-09 03:01:20.893: E/AndroidRuntime(327): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
12-09 03:01:20.893: E/AndroidRuntime(327): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:278)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:263)
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:258)
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:253)
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.app.Activity.setContentView(Activity.java:242)
12-09 03:01:20.893: E/AndroidRuntime(327): at com.example.sample.CourseListActivity.onCreate(CourseListActivity.java:57)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-09 03:01:20.893: E/AndroidRuntime(327): ... 11 more
12-09 03:01:20.893: E/AndroidRuntime(327): Caused by: java.lang.ClassNotFoundException: Could not find class: fragment
12-09 03:01:20.893: E/AndroidRuntime(327): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:318)
12-09 03:01:20.893: E/AndroidRuntime(327): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
12-09 03:01:20.893: E/AndroidRuntime(327): ... 21 more
error log says
Could not find class: fragment
Fragments require API Level 11 or greater :)
If you want to use Fragments on API < 11 you need to use Support Library package for this.
Looks like this was fixed in HoloEverywhere 1.4.1: https://github.com/ChristopheVersieux/HoloEverywhere/issues/
Did updating to 1.4.1 fix the problem for you?
Try to add your fragment programmatically.
That is, your xml should have only the layout 'content' and, onCreate:
if (savedInstanceState == null) {
// Add the fragment on initial activity setup
MyFragment myFragment = new MyFragment();
getSupportFragmentManager().beginTransaction().
add(R.id.content, myFragment).commit();
}

phonegap plugin for eclipse, project not running in default settings

01-26 20:45:50.841: E/AndroidRuntime(327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demo.app/com.demo.app.Sencha_demoActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.os.Handler.dispatchMessage(Handler.java:99)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.os.Looper.loop(Looper.java:123)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-26 20:45:50.841: E/AndroidRuntime(327): at java.lang.reflect.Method.invokeNative(Native Method)
01-26 20:45:50.841: E/AndroidRuntime(327): at java.lang.reflect.Method.invoke(Method.java:521)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-26 20:45:50.841: E/AndroidRuntime(327): at dalvik.system.NativeStart.main(Native Method)
01-26 20:45:50.841: E/AndroidRuntime(327): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-26 20:45:50.841: E/AndroidRuntime(327): at android.content.res.Resources.getValue(Resources.java:891)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1865)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.content.res.Resources.getXml(Resources.java:779)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.phonegap.api.PluginManager.loadPlugins(PluginManager.java:82)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.phonegap.api.PluginManager.<init>(PluginManager.java:62)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.phonegap.DroidGap$1.run(DroidGap.java:414)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.Activity.runOnUiThread(Activity.java:3649)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.phonegap.DroidGap.loadUrlIntoView(DroidGap.java:390)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.phonegap.DroidGap.loadUrl(DroidGap.java:356)
01-26 20:45:50.841: E/AndroidRuntime(327): at com.demo.app.Sencha_demoActivity.onCreate(Sencha_demoActivity.java:11)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-26 20:45:50.841: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
01-26 20:45:50.841: E/AndroidRuntime(327): ... 11 more
I am a absolute beginner to phonegap and sencha touch. After reading many forums I got this plugin for eclipse : http://www.mobiledevelopersolutions.com/home/start/startdetails
But, when I am trying to run the project with google api 2.1 with minsdk version 7, I am getting the error mentioned above. Any ideas how to recitfy it?
I received a report of what is likely the same issue today and tracked it down. See AppLaud Issue #63.
The Sencha file structure changes in 2.0.0-pr4 cause the AppLaud wizard to fail to complete project creation. plugins.xml is missing and AndroidManifest.xml is not set up.
The workaround is to copy sencha-touch-all-debug-w-comments.js to sencha-touch-debug-w-comments.js and then the wizard will succeed with project completion.
This bug will be fixed in the next AppLaud update due out after the PhoneGap 1.4.0 release.
Also, note that the bundled Sencha PhoneGap example in AppLaud does not yet support the Sencha 2 APIs. See AppLaud Issue #64.
Looks like you are missing the res/xml/plugins.xml file from your project.

Categories

Resources