How to get value of application launching time,
from available solution on android log is printed like this I/ActivityTaskManager: Displayed com.android.demo.MainActivity: +1s751ms
Any solution to store this value in variable to use further
I don't think is possible to store that value somehow outside Android Studio because this things and others involving performance issues are viewable only inside SDK. For further references see this:
https://developer.android.com/topic/performance/vitals/launch-time
Related
I'm using Android Studio to debug class field, the things I want to know is:
who and when changed the variable. But it seems that it doesn't work like a regular break point, whenever the field gets changed my application just stops and there is not such option as Step Over or Resume Program in debug window. My tool bar looks unusable:
So, as you can see from the Overhead the field was hit once, and my application stopped afterwards. Also it doesn't show who changed a variable, or how it was changed(via setter or from inside class). How can I make it work?
Both "Add watchpoint" and adding breakpoints every time value is updated almost did the trick.Actually, None of the breakpoints were triggered at all, but it led me to conclusion that the application was not using the correct object at all, and yes, the hashcodes of used object and the object that application
should have used were different, should be more carefull with singleton :)
I'm developing an app using Android Studio. Now I'm facing a bug where the app crashes when I do the following:
Press the home button.
Use the device for some 10 minutes (i.e. wait).
Run the app again. Crash!
There is no easier way to reproduce the crash (nothing in onResume). As you can imagine, this is kind of hard to debug. In an ideal world, the OS (Android 5.0) would let me send a bug report to myself. The app is not published yet, so I don't see how I could get hold of the crash dump. Is it saved somewhere on the device?
I did try to debug the app from Developer Options, using the wait for debugger setting and then attaching to the process from within Android Studio. This, however, seems to make the bug go away. (The app is probably restarted.)
Q: How do I find the cause of the crash given these circumstances?
My intuition tells me that you are using some 'static' variables/fields in your application.
When your app goes to background and it is not used, system could drop process (because of memory management) of this application from memory. When you come back, Application object and all application proces in system is recreated, so all static variables are cleared/reinitialized.
Am i right?
Try looking into your logcat and if that is not an option for you. try some crash analytic like the following.
https://mint.splunk.com/
Integrate it in your app just with a single line and whenever your app get crashed you will receive a mail of your crash logs..
it will easily help you to determine your crash scenario..
And just out of curiosity are you using any singlton class in your Activity.?
I found the crash using adb as described here. Never realized that logcat keeps logs from previous executions. Nice!
I have reached a problem in the final stages of completing my stack. I have been working on this project for a couple months now and it is finally complete. The aim of the app is for you (as the user) to be able to have a type of calculator which performs a certain sequence of sums once a numerical value is entered. It is now finished (thank goodness! :P) but I have reached an error whilst saving this app. I am saving it as an Android application (.apk) for use on a mobile phone. I have the Android personal 1 pack, and my error is as follows:
There was an error while saving the standalone application could not compile application class
I am unsure as to why this is occurring but find it hard to believe that this could have occurred because of either invalid syntax or that a command I was using was incompatible with Android.
As I said before my stack is very simple and only performs a few basic mathematical functions (mainly multiplying contents of fields) by each other. If you wish to see this script, please request.
#ninjabunny14 yep it's a good idea to include code, actual text of error messages, details of the platform you're developing on, versions of LiveCode/Android etc
In the meantime you could Google "error while saving the standalone application could not compile application class" like I've just done and found quite a few links to LiveCode forum threads (like this one http://forums.runrev.com/phpBB2/viewtopic.php?f=53&t=12330) which look like they might be of use...
NinjaBunny,
This sounds more like an error from the Android SDK than a LiveCode error. For starters check these things in the Android settings pane in the LiveCode Standalone Applications Settings:
Identifier: It has to be unique to this application. If you've ever done a test build for Android without changing this default identifier you will get an error.
Signing: Unless you have a key, choose Sign for development only or Don't sign.
Minimum Android version: make sure you have all of the packages needed for your target version in your Android SDK.
Go to Edit/Preferences and set up the Android SDK path, which is probably empty in your case:
I had this a few times because it is easy to forget.
The identifier in the android settings does not like characters like - so do not use a name like com.itis-me.myapp , but use com.itisme.myapp
the use of a character like - gives you this error.
So, I have found a bug in a specific sdk that causes it to fail on some Android phones after re-installing a new version of an app which uses the sdk (via adb install -r, and presumably when a user gets an update that has been pushed to the Android market). Is there any way to force an application's data to automatically be cleared upon update of the app? I realize there are different ways that data could be stored, but I just need to essentially simulate an invocation of the "Clear Data" button that'd you find when browsing to the application in the "Manage Applications" section of the Settings (i.e. I just want all data gone).
I am an Android noob and am doing minimal Java coding on this project, so I am basically looking for the simplest solution here. I suppose I could settle on storing a "currentVersion" to disk and then checking it upon launch every time to see if the real current version matches the version that was written to disk on the last launch. Is that the only real way to do this? If so, what's the simplest way to do so?
Thanks!
Is there any way to force an application's data to automatically be cleared upon update of the app?
No, at least for my definition of "automatic".
I suppose I could settle on storing a "currentVersion" to disk and then checking it upon launch every time to see if the real current version matches the version that was written to disk on the last launch. Is that the only real way to do this?
I'd name it lastKnownVersion, but otherwise this approach seems sound and probably is your only viable option.
If so, what's the simplest way to do so?
Ummm...do exactly what you said. Use Java I/O (storing the file somewhere inside of getFilesDir()), or SharedPreferences.
Bear in mind, though, that your users may get rather frustrated if you blow away their data on an app update. Personally, I'd rather we find a better solution to your original problem ("I have found a bug in a specific sdk that causes it to fail on some Android phones after re-installing a new version of an app which uses the sdk").
I completely revamped an app. Tested it for a while on my device and emulator. The app worked fine. However when I updated the app through the Android market, my users experienced crashes.
Since there is no way to properly debug this procedure I asume the crash is caused by old data which is not being removed from the device (probably from the onsavedstate bundle?!).
Is there a way to do a "clean/total" reinstall without having the user to do it manually?
Best Regards
Johe
When the variable that's giving you trouble is overwritten with the proper type on the next OnPause, the class cast problem should be gone. You could reserve one variable to hold a version number and if the one you retrieve from OnResume is older you skip the other saved values and use the defaults.