Android Studio interview questions and answers

ADB:

1) What is adb?

Android Debug Bridge (ADB) is a command-line tool that performs shell commands.

ADB is used for direct communication between the emulator ports. It gives direct control of the communication between the emulator instances to the developer

2)

ADB is an Android device bridge command-line tool. Basically, we are using ABD for controlling your device over USB from a computer and we can copy files back and forth, install and uninstall apps, run shell commands.

ADB lets you modify your device and its software using the PC command line. Before connecting with ADB we need to remember to put your device in USB debugging mode. This can be found by navigating to Menu>Settings>Applications>Development and checking the box for USB debugging. Without doing this, your PC won’t recognize your device.

ADB is part of Android SDK, from here we can download it. You can connect it using the Terminal window of Android Studio.

Once ADB, install we can all device connected with your machine in this terminal. If your device does not show up, you may have an issue with your drivers. We have many Linux command here to control device. Some commands are:

ll <path-to-file-on-device> <destination-path-on-computer> 
* This command pulls a file from your device to your computer.*
adb install -r <path-to-APK-file>
This command installs an APK file (an app) from your computer to your phone.
adb logcat
This command displays a real-time stream of your device's log on your computer.

DDMS:

1) What is DDMS?

Answer: Android Studio has debugging tools known as DDMS i.e. Dalvik Debug Monitor Server.

It has wide debugging features which include:

  • Port forwarding services.
  • Screen capture on the device.
  • Thread and Heap information.
  • Incoming call and SMS spoofing.
  • Logcat
  • Radio state information.
  • Location data spoofing.

DDMS is integrated with the Android studio. To launch the DDMS, you need to open the Android Device Monitor (ADM) first and then click on the DDMS menu button. Once DDMS is launched, then on the left-hand side the list of connected devices is displayed along with the processes which are running on each device.

With the help of DDMS, you can debug both on real devices and emulators

AAPT:

1) What is AAPT?

AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.

PROGUARD:

 CAN YOU THINK OF A LIMITATION OF PROGUARD, AND WHICH OTHER

PRODUCT CAN OVERCOME IT?

ProGuard does not obfuscate strings from an application, so they are always visible

after applying it.

We can think of two immediate solutions: using NDK we can store the strings in a

natively compiled file and access it through JNI, although this is security by obscurity

and it can be criticized. The other method is to use an engine such as DexGuard[17],

which also obfuscates Strings.

DO YOU KNOW TOOLS YOU CAN USE TO ACCESS THE SOURCE CODE OF AN APPLICATION?

Even if the source code of an application has been obfuscated with ProGuard, there is a free set of tools available that we can use to reverse engineer an application and access it's source code.

-ApkTool [18]disassembles a file very nearly to is original form.

-Dex2Jar[19] translates .dex files into .class files. Therefore it is easy to read with some other applications.

-Java Decompiler [20]can open jar files and present them in the form of Java files (so it can read for examples files that have been translated with Dex2Jar.

How Proguard works?

Proguard is a way to obfuscate the code to make it difficult to reverse engineer the code and also reduce the APK size via tree shrinking.

Obfuscating the code is a process to modify the code in a way that it’s no longer useful to the hacker. Proguard modifies the code with short names like with alphabets. If you try to decode the APK you would understand it. By using short names instead of full-length class and variable names it’ll reduce the APK size and obfuscate the code simultaneously. To learn more about it read the following article:

What is the mapping file with regard to proguard?

Obfuscating the code is a great way to secure the code. We know that obfuscation means modifying the code, this will make it difficult for developers to decode the crash reports. Fortunately, R8 creates a mapping.txt file each time it runs, which contains the obfuscated class, method, and field names mapped to the original names.

We need to upload this mapping file to the play console or any analytics tool that you use like Sentry to understand the crash or analytics report.

Differences between proguard and dexguard?

  1. ProGuard is a generic optimizer for Java bytecode, whereas DexGuard is a specialized tool for the protection of Android applications.
  2. ProGuard provides minimal obfuscation, whereas DexGuard applies multiple layers of encryption and obfuscation.
  3. ProGuard is an open-source tool, whereas DexGuard is a commercial, enterprise-grade product.

Network Profiler:

Comments