In 2020 BAT Andrews interview focus: Java + Custom View + + NDK + Flutter Performance Optimization

Andrews interview focused on what?

I collected a variety of information about the Andrews interview, bringing together manufacturers and small companies face by sharing the interview questions.

Technology constantly updated. By finishing the latest analysis of the major companies face questions, Andrews better grasp of market demand.

Android most frequently asked technical interview;
the Java related infrastructure, data structures and algorithms, performance tuning, design patterns, NDK, artificial intelligence, audio and video as well as the development of hybrid development.

I summed up the Andrews interview involved and the scope of frequently asked questions Frequently Asked surface (with answers), as well as advanced video system information. And each technical presentations made finishing skill trees.
Most of which are large enterprises face interview frequently asked questions, you can control this leak filled, of course, listed here certainly can not cover all the way, but also hoping to play some help to find a job soon friends!

A, Java chapter

1. multithreading;

  • the difference between sleep and wait
  • join usage
  • Thread Synchronization: synchronized keyword, etc.
  • Thread communication
  • Thread Pool
  • Handwriting deadlock

The 2.Java reference, and their respective usage scenarios
source 3.HashMap of
what 4.GC (garbage collection) that? How does it work? What recovery algorithm
5.Error Exception and the difference?
6. Notes reflection and understanding it? Projects have used it?
7. Network Related:

  • http status codes
  • The difference between http and https? Https how it works?

8.Java in LRUCache is (source angle) how to achieve it? Why LinkedHashmap?
9. Design Patterns:

  • Principle volitate keyword handwritten Singleton
  • Handwriting producer-consumer model
  • What projects have used design patterns?
  • Design principles coding often follow: single responsibility, the principle of opening and closing, Richter replacement, etc.

10.ArrayList and LinkedList difference?

Second, the Custom View

1. Source Related:

  • Activity during startup
  • Event distribution source, as well as events derived therefrom interception how
  • Messaging: What happens when Handler source (combined Looper, MessageQueue), and did not get the message?
  • Why View.post can get the width and height?

2. Customize View;

  • Process: onMeasure, onLayout, onDraw
  • onMeasure in MeasureSpec is how to calculate?

3.Dalvik running .dex customized byte code format.
4. How to Capture application global exception?
5.Service is to use the difference between the start and bind?
IPC mechanism 6.Android of what? (Then asked down)
7. property animation source?
Figure 8. Large load
9.ANR how to locate, how to analyze? (Trace log)
is used in which 10 projects open source library? Pick a talk about the source?
11.MVC and MVP difference?
12.Activity:

  • A start B, the life cycle is how to go? (Note that if B is a clear distinction)
  • Start mode

13.AsyncTask principle?

Third, performance optimization

1.Android UI adaptation;

The font used sp, using dp, multi-use match_parent, wrap_content, weight

Picture resources, different picture resolution, in the corresponding folder can be used instead of a percentage.

2.app :( optimization tools: Hierarchy Viewer layout analysis tool: TraceView test analysis and time-consuming)
3.App start optimization
4. Layout Optimization (try not to be too complex nested can use ,,).
5. Response Optimization ;;

  • Android system every 16ms will send a signal to redraw our VSYNC interface (Activity)
  • Page Caton reasons: (1) too complex layout (2) complex calculations UI thread (3) frequent GC
  • Resulting in frequent GC for two reasons:
    (-1), memory jitter, which is a large number of objects are created and soon to be released in a short time (2), and instantly generate a large number of objects can seriously take up memory area.

6. Memory Optimization: reference memory leaks and memory overflow portion

The battery using the optimized (tools: Batterystats & bugreport);

  • Optimization of network requests

  • Positioning using GPS, please remember to close

8. Network Optimization (network effects on the user's connection: traffic, power, wait for the user) Network Monitor tool that can be detected in the next Android studio below logcat

  • API Design: API design between the App Server and to consider the frequency, state resources such as network requests to App can be accomplished with fewer requests show business requirements and interfaces.
  • Gzip compression: Gzip used to compress request and Response, reduce the volume of data, thereby reducing the consumption flow.
  • Picture Size: you can tell when the server needs to take a picture of the picture width and height, so that the server is given the right picture, to avoid wastage.
  • Network Cache: Cache appropriate, both to make our application look faster, but also to avoid unnecessary traffic consumption.

9. The image optimization;

  • The picture itself operates. Try not to use setImageBitmap, setImageResource, BitmapFactory.decodeResource to set up a big picture, because these methods after the completion of decode, ultimately by createBitmap java layer to complete, need to consume more memory.
  • Ratio image to zoom in, SDK recommended value is an index value of 2, the value of the General Assembly, resulting in pictures are not clear.
  • The pictures do not remember to call the picture recycle () method

Four, NDK and cutting-edge technology
1. Talk about your understanding of the NDK and JNI;

  • JNI is an acronym for Java Native Interface and the Java native interface.
  • The purpose is to make Java and other local languages ​​(such as C / C ++) to interact.
  • Java JNI is part of, and not directly related to Android.
  • NDK is an acronym for Native Development Kit and the Android SDK tools.
  • Role is more convenient and rapid development of C / C ++ DLL, and automatically packaged into a dynamic library apk together with the application.
  • Android NDK is part of, and not directly related to Java.
    Summary:
    JNI purpose is achieved, NDK Android is a means to achieve the JNI.

2. Talk about your understanding of JNIEnv and JavaVM;

  • JavaVM is representative of a virtual machine in the JNI layer
  • A process has only one JavaVM. (important!)
  • All threads share a JavaVM. (important!)
  • JNIEnv indicates that the Java native language calling environment, encapsulates almost all JNI pointer method.
  • JNIEnv only thread that created it entered into force, it can not pass across threads, different threads JNIEnv independent of each other. (IMPORTANT!)
    Note:
    thread created under the native environment, in order to communicate and java, the need to obtain a JNIEnv object. We DetachCurrentThread AttachCurrentThread and methods associated with the native threads JavaVM and disassociation.

3. how to position the NDK problems and errors;

  • Generally during the development phase, we can locate and analyze problems by log
  • If it is on-line state (ie, closed the basic log), we can use the tools and addr2line objdump NDK provides tools to locate errors
  • You can also use other C / C ++ some of the analytical tools
  1. Static registration and dynamic registration;
  • Static registration; by  JNIEXPORT and  JNICALL two macro definition statement, Java + 包名 + 类名 + 方法名 in the form of the function name. Good place is the method name is too long.
  • Dynamic registration; normally registered by RegisterNatives method JNI_OnLoad method, can no longer be written to comply with the fixed name (of course, readily be understood that for the code, name or consistent as possible and Java)

5.API

Some abnormal test subject will still use some of your API, such as how to call methods in Java JNI inside, how to throw exceptions in JNI inside, and so on. So some still have to familiarize yourself with the API, it is roughly what features the name roughly Shaya, this too much, not described in detail.

Five, Flutter;

  • flutter development environment to build

  • Flutter coding language dart understanding?
    object-oriented principles dart
    dart variables, similarities and differences functions, operators, syntax Java exception principle
    mechanistic classes of
    rules initializer
    named constructor
    mixin

  • Flutter framework of principles, and the use of techniques (layout analysis, how to customize the view? Animation / gesture interaction, multi-threaded development principles, whether the combat posted their flutter library)

Lastly, I hope we can develop a habit of lifelong learning, technology is never-ending.

Published 56 original articles · won praise 1 · views 2909

Guess you like

Origin blog.csdn.net/chuhe1989/article/details/104622541