it on the page. The advantage of this plug-in is that you can check the memory leaks directly on the phone and help us detect the memory leaks.Use:Add in the Build.gradle file, different compilations use different references:?
1234
class=" hljs matlab">dependencies { debugCompile ‘com.squareup.leakcanary:leakcanary-android:1.3‘releaseCompile ‘com.squareup.leakcanary:leakcanary-android-no-op:1.3‘}
Add Leakcanary.install (this) to the application's application OnCr
hard disk cache) Filecountlimiteddisccache (You can set the number of cached pictures, when more than the set value, delete the first file added to the hard disk) Limitedagedisccache (set file to survive for the longest time, when this value is exceeded, delete the file) Totalsizelimiteddisccache (sets the maximum cache bitmap, when this value is exceeded, deletes the file first added to the hard disk) Unlimiteddisccache (This cache class does not have any restrictions)
Picasso is
unit testing is that you are not using a simulated environment, but rather the actual implementation of the object in the test. You can simulate data transfer (MOCKWEBSERVER) and database status, then run real code to see how they work.You can run the integration test on the Android instrumentation or JVM device/emulator because the test runs faster on the JVM-the author prefers the JVM.Fail early: Run the integration test in CI and discard the project as early as possible if some of the tests
.
Scenario 2: similar to the online problem locating just now, a large number of excellent offline functions cannot be applied to all users, because they are actually hurting the enemy by eight hundred and self-healing by one thousand. How can we recall all problems as much as possible while minimizing user experience loss?
A new idea for mobile terminal online problem locating:Build a test plug-in based on the plug-in system to integrate all the offline test capabilities that we find useful,
-written frameworks. Apart from some UIS, I can find lib and write my own framework. After all, it is difficult to meet a specific requirement if the architecture is improved.
The following pure recommendations do not mean I have used them. If something goes wrong, don't bother me.
Network Layer: suitable fit, Volley + OkHttp, async-http-lib should be used as far as possible, relatively old. In addition, these need to be further extended. You can search for them and integrate them if they are us
-image-loaderPowerful picture download display class, the most complete and stable functionHttps://github.com/nostra13/Android-Universal-Image-LoaderPhotoViewPowerful picture gesture Zoom LibraryHttps://github.com/chrisbanes/PhotoViewzxingQR Code scanning ToolHttps://github.com/zxing/zxingLeakcanaryLeakcanary is an open source class library that detects memory leaks. You can easily detect memory leaks in the debug package.Https://github.com/square/leakcanaryHttps://github.com/liaohuqiu/
for relevant metadata and album information on itunes and display the results. If more than one song is matched, you can find the entry you need.The song itself is downloaded from pleer.com, and you can filter by high quality, low quality or VBR bitrate. It is also a mini-player that we listen to songs directly and no longer pass through other music libraries.Search and download9. Check for leakage issuesLeakcanary is a set of open source libraries designed to help us resolve memory leak issues
display the results. If more than one song is matched, you can find the entry you need.The song itself is downloaded from pleer.com, and you can filter by high quality, low quality or VBR bitrate. It is also a mini-player that we listen to songs directly and no longer pass through other music libraries.Search and download9. Check for leakage issuesLeakcanary is a set of open source libraries designed to help us resolve memory leak issues. You can use it to check for memory leaks in Java (with A
Use android studio to detect app Memory leakage [reprinted] And androidapp
In Android development, various memory leaks are inevitable. If you do not find and handle the vulnerabilities in time, the larger the memory usage, and various strange crash may occur due to memory leaks, the APP may even crash due to insufficient memory.
Generally, android Memory leakage detection uses the built-in Monitor Tool of android studio in combination with mat, or a third-party open-source library tool: leakCan
Serializable interface and the Parcelable interface, but it is recommended to use parcelable in Android, but this is more cumbersome than the serializable approach. Then with this plugin everything is OK.5, LeakcanaryIt is highly recommended to help you detect memory leaks conveniently during the development phase, which is easier and easier to use.English is not good here have Comrade Lei Feng translation of Chinese version leakcanary Chinese use in
detects app memory leaks: leakcanary (can detect memory leaks in your app)SummarizeAlthough mobile phone memory is constantly improving, memory leaks may not be like the Dalvik era due to the virtual machine memory too small cause a variety of oom. However, excessive memory leaks will still cause memory overflow, affect the user experience, in today's custom system, more and more models to solve the problem of memory leaks will make the adaptation an
the ever-changing new technology will be at ease.2, the ability to concatenate trivial knowledge, that is, to summarize the ability. Whether in the work or study, the first use of knowledge is a piece of East, west, in fact, many things are related, through the systematic comb to form their own knowledge system, to create their own exclusive domain, which is also in the Java community based on the fundamental.These are purely their own this time of the blind think nonsense, we encourage each ot
Class)4. Third-party library Leakcanary (extremely simple)Leakcanary's GitHub Address5. Instance solutions for memory leaksinstead of resolving memory leaks, it is more about avoiding memory leaks. Because once a memory leak occurs, the memory restarts, even if the JVM needs to be restarted, that is, restarting the application. Even if it does, it can't be solved.1. Memory leaks due to changes in collection objects//In this example, because the prope
tools: Junit,monkeyrunner,uiautomator,espresso, etc.13. Debugging the Framework
name
Description
Stetho
Debug your Android app's bridge, making it possible to debug with chrome developer tools
14. Performance optimization
name
Description
Leakcanary
Memory Leak Detection Tool
ACRA
Android app crash report
Responsive extensions on the JVM
Rxjavajoins
Provides joins operation for Rxjava
Rxandroid
Responsive extensions on Android, added Android thread scheduling on Rxjava basis
Rxbinding
Provides an API to bind the Android UI with Rxjava
Agera
Responsive programming on Android
One. Log frame
name
Description
Logger
Simple, beautiful, powerful Android loggi
is android-arsenal specifically designed for developers to use. The following will also be introduced.
Below we refer to these tags as badges (shields).Top Android Open Source Project badgeWe tried to search for the Android keyword in GitHub to develop an open source project with Java as the language.
The statistics are as follows:
Retrofit 0
Okhttp 0
Butter Knife 0
Mpandroidchart 4
Android-universal-image-loader 2
Glide 1
Rxjavajoins
Provides joins operation for Rxjava
Rxandroid
Responsive extensions on Android, added Android thread scheduling on Rxjava basis
Rxbinding
Provides an API to bind the Android UI with Rxjava
Agera
Responsive programming on Android
A. Log framework
name
Description
Logger
Simple, beautiful, powerful Android logging tool
Hugo
Log
in use.# # # #Android中内存泄漏 The garbage collection mechanism in Android does not prevent memory leaks from causing memory leaks The main reason is that some live objects hold references to other objects that should be recycled, causing the garbage collector to fail to reclaim those objects, which is a memory leak. For example, a system component like activity, which contains many controls and even pictures, is a serious memory leak if it cannot be reclaimed by the garbage collector. For example,
triggers GC when memory is high);
The application is being emptied from the background process;
Application of inexplicable crashes (i.e. exceeding the heepsize threshold caused by oom).
Memory Leak analysis ToolSee these problems. Suddenly found that it seems to be closer to the truth 0.0.To get a clearer picture of the current application's memory usage in real time, we need to implement it through some tools. There are two types of tools that are more useful:
Memory Ana
, often use a few buffers, when not in use, should close them in time.
The registration object is not logged off. For example, an event that does not log off after registration causes the object's reference to be maintained in the Observer list.
The static variables of the class hold large data objects.
A static instance of a non-static inner class.
Handler temporary memory leaks. If the handler is non-static, it is easy to cause Activity or Service not to be recycled.
A memo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.