Android development pit record

  1. Dial-up function
    1) Before calling the dial-up interface, you need to determine whether the current device has a dial-up program. You can use try-catch to catch the opening exception to avoid application flashback.
  2. Webview development problems
    1) Cache problem - if the cache is not turned on, some functions of the webpage may not be used normally, and abnormal conditions may occur.
    2) The methods under the WebViewClient object are asynchronous callback methods. If there are android UI related operations in these methods, you need to pay attention When the activity is closed, the corresponding operation is no longer performed, such as the closing operation of the dialog, which is performed in advance in onDestroy(), and the synchronization lock is used for the display and closing of the dialog.
    3) URL interception will lead to the loss of header information (there may be other information Lost), resulting in some abnormal functions, so it should be used with caution
    4) Regarding the 302 redirection problem, it has not been resolved
  3. Floating window problems
    1) Adding a floating window multiple times will cause a flashback - use try-catch around the code for adding or removing a floating window to catch exceptions to avoid flashback
    2) If the floating button needs to move globally, you need to set the flags attribute It is FLAG_LAYOUT_IN_SCREEN, but do not set FLAG_LAYOUT_INSET_DECOR at the same time, otherwise the floating button under the status bar will be blocked by part of the view
  4. File operation problems
    1) Perform file operations in the main thread ANR may occur in a small number of 4.4 models, so in order to avoid ANR, try not to operate files in the main thread
  5. Multi-interface switching problem at the same time (android system bug)
    1) When the current application is switching the interface and the application is also switching, some models will appear ANR, and it may also appear when the interface is frequently and quickly switched - try to avoid frequent interface switching And do not perform interface switching related operations when the application jumps
  6. Third-party login:
    1) The signature configuration of QQ authorized login needs to be all lowercase
    . 2) The signature configuration of WeChat authorized login needs to be all uppercase
    . 3) Note that the package name and appID must be configured with the third-party background
    . Authorization, it may be a cache problem (such as: WeChat cached the wrong signature ticket)
    5) Do not manually type in the signature, it must be copied, otherwise it is very easy to make mistakes (it has stepped on the pit, and it is very deep 6 )
    The signature acquisition tools provided by QQ cannot acquire the signatures of some applications, but you can use the signature acquisition tools provided by WeChat or Weibo to acquire them
  7. When configuring meta-data data in the manifast file, if the value of the attribute value is a long string of numbers, it must be preceded by "\" (slashes and spaces), otherwise the value will be modified after compilation, so that Cause an error; if the original value=”1234567890123”, then it should be changed to value=”\ 1234567890123”, so that the corresponding value in the compiled apk is correct
  8. To be added. . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325812349&siteId=291194637