Book Image

Testing and securing android studio applications

Book Image

Testing and securing android studio applications

Overview of this book

Table of Contents (18 chapters)
Testing and Securing Android Studio Applications
About the Authors
About the Reviewers


Mobile applications have become very popular in the last few years thanks to a huge increment in the use of mobile devices. From a developer's point of view, Android has become an important source of income thanks to the different app repositories, such as Google Play and Amazon Appstore.

With an increase in the number of applications available, users have become more demanding about the features of the applications they are going to use. A solid testing of the application and its security aspects are the key factors in the pursuit of success for an application. Bugs and security issues are obviously not features that help your application do well in the increasingly more exigent market of Android.

In this book, you are going to learn how to turn your Android application into a solidly debugged and secure application. To achieve this, you will learn how to use Android Studio and its most important features: testing and security.

What this book covers

Chapter 1, Introduction to Software Security, introduces the principles of software security.

Chapter 2, Security in Android Applications, describes the distinctive features found in mobile environments and the Android system.

Chapter 3, Monitoring Your Application, presents the debugging environment, one of the most important features of an IDE.

Chapter 4, Mitigating Vulnerabilities, describes the measures that should be taken to prevent attacks.

Chapter 5, Preserving Data Privacy, presents the mechanisms offered by Android to preserve the privacy of user data.

Chapter 6, Securing Communications, explains the mechanisms offered by Android to secure communications between an Android application and an external server.

Chapter 7, Authentication Methods, presents different types of authentication methods used in Android mobile devices.

Chapter 8, Testing Your Application, introduces ways to test an application using Android Studio.

Chapter 9, Unit and Functional Tests, covers unit and functional tests that allow developers to quickly verify the state and behavior of an activity on its own.

Chapter 10, Supporting Tools, presents a set of external tools different from Android Studio to help developers test an Android application.

Chapter 11, Further Considerations, provides some further considerations that are useful for developers.

What you need for this book

For this book, you need a computer with a Windows, Mac OS, or Linux system. You will also need to have Java and the Android Studio IDE installed on your system.

Who this book is for

This book is a guide for developers with some Android knowledge, but who do not know how to test their applications using Android Studio. This book is suitable for developers who have knowledge about software security but not about security in mobile applications, and also for developers who do not have any knowledge about software security. It's assumed that you are familiar with Android and it is also recommended to be familiar with the Android Studio IDE.


In this book, you will find a number of text styles that will help you distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "To send an ordered broadcast, you can call the sendOrderedBroadcast method."

A block of code is set as follows:

Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(SecondActivity.class.getName(), null, false);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

protected void setUp() throws Exception {

Intent intent = new Intent(getInstrumentation().getTargetContext(), MainActivity.class);
startActivity(intent, null, null);
mActivity = getActivity();

Any command-line input or output is written as follows:

adb shell monkey –p com.packt.package –v 100

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The multiplication is made when the Button1 button is clicked."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.