Home Computer Tutorials Computer Knowledge Learn how to retrieve log records from Android client software

Learn how to retrieve log records from Android client software

Jan 09, 2024 pm 07:06 PM

How to view the android client software log

To output logs in the program, use the android.util.Log class.

This class provides several static methods

Log.v(String tag, String msg);

Log.d(String tag, String msg);

Log.i(String tag, String msg);

Log.w(String tag, String msg);

Log.e(String tag, String msg);

In order to help players understand better, let us take a look at the meaning of each option: Verbose (verbose mode), Debug (debug mode), Info (information mode), Warning (warning mode), Error ( error mode).

tag is a string used for identification, usually composed of class name and method name. It plays an important role when viewing logs and can be used as a filter to locate specific log information.

After the program is run, no information will be output in the IDE console.

If you want to view the log later, please use

adb logcat

For more information about adb, please check the official website.

After executing the adb logcat command, all log information will be displayed in real time in tail mode.

Now we need to filter the information and only display the information we need. At this time, the specified tag is very useful.

adb logcat -s MyAndroid:I

Now, only log information with the label "MyAndroid" and level I or higher (including Warning and Error) will be displayed.

The sample code is as follows:

Learn how to retrieve log records from Android client software

Learn how to retrieve log records from Android client software

Learn how to retrieve log records from Android client software

If no filtering rules are specified in the command line, the filtering rules will be set from ANDROID_LOG_TAG.

In order to help players who have not passed the level yet, let us learn about the specific puzzle solving methods. If no clues are found in the game, the default filter is "*:I".

If the -v parameter is not specified, the log format will be set according to ANDROID_PRINTF_LOG.

or defaults to "brief"

Mobile Android Android2 3 3 What does it mean? I only know 2 3 and Android 2 2 x and above

Android2.3.3 represents other versions of the SDK version number 2.3, similar to 2.3.5.

There is also Android 2.2.x or above, which means that the compatible version of the program is

2.2 and above version

for example:

We start by creating a new Android project, named HelloAndroid, and select Android 2.2 version. Fill in 8 in minSdkVersion and click Finish.

Now, let’s run HelloAndroid, which will start a version 2.2 emulator.

3. If we now modify android:minSdkVersion=7 in the AndroidManifest.xml file and run it again, it will run on the 2.2 emulator we have opened. Because the Android API is backward compatible, when the system is compiled, this Project is compiled using the 2.1 version, but it can also be run on the 2.2 emulator; if we first close the 2.2 emulator, then run the HelloAndroid Project If so, then a new simulator with API Level=7 will be created to run this program (that is, the 2.1 simulator).

If we modify android:minSdkVersion=10, no matter whether the 2.2 version of the simulator is opened or not, an error will occur.

To help those who encounter the "ERROR: Application requires API version 10. Device API version is 8 (Android 2.2)." problem, I will share some solutions. First of all, this error means that your device's Android version is too low and needs to be upgraded to API version 10 to run the app. You can try the following methods to solve the problem: 1. Check whether the device can be upgraded to a higher Android version. 2. If the device cannot be upgraded, try to find a lower version of the application that matches your device. 3. If the application is developed by yourself, you can try to adjust the API version requirements to suit your

Launch canceled!

How to view android source code in eclipse

When we develop android programs in eclipse, we often need to look at the source code (maybe out of curiosity, maybe out of habit of reading source code), so how to check the Android source code?

For example, the following situation

Learn how to retrieve log records from Android client software

If we want to view the source code of the Activity class, usually pressing the Ctrl key and left-clicking the class should be able to display the code. But sometimes we may encounter a prompt that the Activity.class file cannot be found. This may be caused by project configuration issues or incorrect IDE settings. To solve this problem, you can try to re-import the project or check the IDE settings to ensure that the relevant class files can be loaded correctly.

Learn how to retrieve log records from Android client software

At this point, click the button below, find the "Change Attached Source..." option, and then select the location of the android source code. In this way, a dialog box similar to Figure 3 will pop up.

Learn how to retrieve log records from Android client software

The first is to select the working directory, which is the existing android application source code.

The second method is divided into two ways

In order to solve this problem, we need to follow the following steps: First, click the "External File..." button, and then select the path of the Jar format file or zip format file to be added.

(2) Select the External Floder... button and add the path to the folder.

The next question arises, where is the source code? It cannot be created out of thin air.

In order to help players who have not passed the level yet, let us learn about the specific puzzle solving methods. Source code downloading through Android SDK Manager is a recommended method, as shown in Figure 4. This can help players solve problems better.

Learn how to retrieve log records from Android client software

Check Source for Android SDK and download it.

In addition, it can also be downloaded through other channels. There are many shared resources on the Internet.

Here we choose the second method (2), that is, select the directory where the source code is located, as shown in Figure 5.

Learn how to retrieve log records from Android client software

After clicking the "OK" button, the Activity file will be able to view the source code, as shown in Figure 6.

Learn how to retrieve log records from Android client software

This is done! ! !

The above is the detailed content of Learn how to retrieve log records from Android client software. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
Fixdisk Windows 7: Check Your Hard Disk for Errors on Windows 7 Fixdisk Windows 7: Check Your Hard Disk for Errors on Windows 7 Apr 14, 2025 am 12:40 AM

If you suspect your hard drive encounters issues, you can check the drive for errors on Windows 7. This php.cn post talks about fixdisk Windows 7. You can follow the guide to check the hard drive for errors on Windows 7.

Is Core Isolation Blocked by ew_usbccgpfilter.sys? Here Are Fixes! Is Core Isolation Blocked by ew_usbccgpfilter.sys? Here Are Fixes! Apr 13, 2025 am 12:47 AM

Many SurfaceBook users report that they meet the “core isolation blocked by ew_usbccgpfilter.sys” issue on Windows 11/10. This post from php.cn helps to fix the annoying issue. Keep on your reading.

Effortles Fixes for Black Screen After Installing a Graphics Driver Effortles Fixes for Black Screen After Installing a Graphics Driver Apr 15, 2025 am 12:11 AM

Have you ever encountered a black screen after installing a graphics driver like an Nvidia driver in Windows 10/11? Now in this post from php.cn, you can find a couple of worth trying solutions to the Nvidia driver update black screen.

KB2267602 Fails to Install: Here Is How to Fix It! KB2267602 Fails to Install: Here Is How to Fix It! Apr 15, 2025 am 12:48 AM

KB2267602 is a protection or definition update for Windows Defender designed to fix vulnerabilities and threats in Windows. Some users reported that they were unable to install KB2267602. This post from php.cn introduces how to fix the “KB2267602 fai

Difference Between RAID Recovery and Hard Drive Recovery Difference Between RAID Recovery and Hard Drive Recovery Apr 17, 2025 am 12:50 AM

Data recovery is always a heated topic. To successfully restore data from your device, you should know how it stores data. You can learn the difference between RAID recovery and hard drive recovery from this php.cn post.

How to Fix the File System Error (-1073741521) in Windows? - MiniTool How to Fix the File System Error (-1073741521) in Windows? - MiniTool Apr 16, 2025 am 12:37 AM

File system errors commonly happen on people’s computer and the error can trigger a series of linked malfunctions. This article on php.cn Website will give you a series of fixes to targeting the file system error (-1073741521). Please keep on with yo

How to Fix FileType Selected Not Supported by This App How to Fix FileType Selected Not Supported by This App Apr 13, 2025 am 12:41 AM

Are you suffering from the error message "FileType selected not supported by this app" when opening files in Teams or Excel? Now read this post from php.cn to get several useful solutions to this issue.

Fix Security Tab Not showing in Folder Properties Windows 11 Fix Security Tab Not showing in Folder Properties Windows 11 Apr 17, 2025 am 12:36 AM

The Security tab in File Properties helps set different permissions for different groups and users to a file or folder. Some users find that Windows 11 Security tab missing from File Properties. This post from php.cn gives some methods to fix it.

See all articles