app crashes

  • Replies:7
Steven
  • Forum posts: 7

Sep 8, 2018, 11:55:14 PM via Website

My app compiles fine. When run in mobile device crashes when button to load second activity is clicked (SEE MORE is button name). there are six files involved: MainActivity.java, Main2Activity.java, activity_main.xml, activity_main2.xml, content_main.xml, content_main2.xml . plus I have a lengthy logcat file using an emulator. this platform does not seem to have file upload abilities. and in the space of one comment not possible to display all these files. is there one key file to help resolve this crash?

Reply
James Watson
  • Forum posts: 1,583

Sep 9, 2018, 3:32:09 AM via Website

You had better set a breakpoint in the button-click event handler, and then try to step-debug.

— modified on Sep 9, 2018, 4:30:51 AM

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

Helpful?
SorinSteven
Reply
Steven
  • Forum posts: 7

Sep 9, 2018, 8:10:37 PM via Website

this is good advice. I will download and install the Google Developer tools and set that breakpoint as you recommend then diagnose the error. up to now was trying to use logcat in Android Studio but it's lengthly output did not help me much. after I try this I will write back with results. THANKS

Helpful?
Sorin
Reply
Steven
  • Forum posts: 7

Sep 10, 2018, 12:02:41 AM via Website

problem. my developer options activated on my mobile. app installed. to view my mobile device with the developer console and put breakpoints then debug FIRST a bridge is required when typing the link //developers/android.com/sdk/index to download the bridge it redirects to Android Studio which I already have installed on my PC

Helpful?
Sorin
Reply
Steven
  • Forum posts: 7

Sep 10, 2018, 12:20:54 AM via Website

turns out I have the driver. as I have used Android Studio SDK manager and logcat, I already have the bridge.
but I do not see how to view my mobile device once the developer console is loaded on my PC. do not see how to get to first base so to speak.

Helpful?
Sorin
Reply
Steven
  • Forum posts: 7

Sep 10, 2018, 12:34:55 AM via Website

on my PC with my mobile connected going to Device Manager, then portable devices, I see my Samsung Galaxy phone. And properties indicate all is proper.
so the issue is how to view it in the console?
please help. thanks.

Helpful?
Sorin
Reply
Steven
  • Forum posts: 7

Sep 10, 2018, 6:08:17 PM via Website

my moble is connected. it has developer tools activated. it is recognized by my PC. in device manager it shows.
when opening the console in Chrome I see on the right side html output and tabs such as elements, console, sources. how do I see my mobile device and the app I wish to debug?

Helpful?
Sorin
Reply
Steven
  • Forum posts: 7

Sep 11, 2018, 7:24:34 PM via Website

in Android Studio running debug with my mobile connected with usb set a breakpoint at button click event handler in the MainActivity.java file.
Here are the results:[code]
this = {MainActivity@4121}
savedInstanceState = null
button = {AppCompatButton@4122} "android.support.v7.widget.AppCompatButton{9a56624 VFED..C.. ......ID 0,0-0,0 #7f0c006e app:id/MyButton}"
mBackgroundTintHelper = {AppCompatBackgroundHelper@4161}
mBoring = null
mBreakStrategy = 0
mBufferType = {TextView$BufferType@4164} "NORMAL"
mDeferScroll = -1
mDesiredHeightAtMeasure = -1
mDispatchTemporaryDetach = false
mDrawables = null
mEditableFactory = {Editable$Factory@4165}
mEditor = null
mEllipsize = null
mLinksClickable = true
mListeners = null
mMaxMode = 1
mMaxWidth = 2147483647
mMaxWidthMode = 2
mMaximum = 2147483647
mMinMode = 2
mMinWidth = 132
mMinWidthMode = 2
mMinimum = 72
mMovement = null
mOldMaxMode = 1
mOldMaximum = 2147483647
mPreDrawListenerDetached = false
mPreDrawRegistered = false
mPreventDefaultMovement = false
mRestartMarquee = false
mSavedHintLayout = null
mSavedLayout = null
mSavedMarqueeModeLayout = null
mScroller = null
mTextColor = {ColorStateList@4172} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[-16842910], []]mColors=[973078528, -570425344]mDefaultColor=-570425344}"
mTextDir = null
mTextSelectHandleRightRes = 17303283
mTransformation = {AllCapsTransformationMethod@4174}
mTransformed = "SEE MORE"
mUserSetTextScaleX = false
mAccessibilityCursorPosition = -1
mAccessibilityDelegate = null
mAccessibilityTraversalAfterId = -1
mAccessibilityTraversalBeforeId = -1
mAccessibilityViewId = -1
mDrawableState = {int[2]@4178}
mDrawingCache = null
mDrawingCacheBackgroundColor = 0
mFloatingTreeObserver = null
mForegroundInfo = null
mGhostView = null
mHasPerformedLongPress = false
mID = 2131492974
mIgnoreNextUpEvent = false
mInContextButtonPress = false
mInputEventConsistencyVerifier = null
mKeyedTags = null
mLabelForId = -1
mLastIsOpaque = true
mLayerPaint = null
mLayerType = 0
mNextFocusUpId = -1
mOldHeightMeasureSpec = -2147483648
mOldWidthMeasureSpec = -2147483648
mOutlineProvider = {ViewOutlineProvider$1@4180}
mOverScrollMode = 1
mOverlay = null
mParent = {CoordinatorLayout@4181} "android.support.design.widget.CoordinatorLayout{63dbf9b V.E...... ......I. 0,0-0,0}"
mSendViewScrolledAccessibilityEvent = null
mSendViewStateChangedAccessibilityEvent = null
mSendingHoverAccessibilityEvents = false
mStartActivityRequestWho = null
mStateListAnimator = {StateListAnimator@4184}
mSystemUiVisibility = 0
mTag = null
mUnsetPressedState = null
mUserPaddingBottom = 0
mUserPaddingEnd = -2147483648
mUserPaddingLeft = 0
mUserPaddingLeftInitial = 0
mUserPaddingRight = 0
mUserPaddingRightInitial = 0
mUserPaddingStart = -2147483648
mVerticalScrollFactor = 0.0
mVerticalScrollbarPosition = 0
mViewFlags = 402669569
mWindowAttachCount = 0
shadow$_klass_ = {Class@4119} "class android.support.v7.widget.AppCompatButton"
shadow$_monitor_ = -1985649116
[/code]obvious unnecessary lines removed

Helpful?
Sorin
Reply