Android Studio Development Essentials Errata

Android Studio Development Essentials was published on July 21, 2014. The current revision is 2.0b. The revision of your copy of the book can be found in the copyright page at the start of the book.

Revision 2.0 of the book was published on January 12, 2015 and has been fully updated to cover the changes introduced in the Android Studio 1.x release and the Android 5 SDK. If you have an earlier revision of the book, email proof of purchase to feedbac[email protected] and we will provide you with a free download of the latest revision of the book in eBook format.

Known Issues with Revision 2.0b

Section 5.5

The setting of the Target Device option in this section is shown as an example only and is not intended to be a step taken in the tutorial. If you set this option to "Emulator" mode, be sure to switch it back to "Show chooser dialog" mode before moving on to the next chapter of the book.

55.5 Creating the Application APK File

The steps to enable ProGuard when building the release APK file have changed in Android Studio 1.2. The steps to enable ProGuard in Android Studio 1.2 are as follows:

1. Display the Project Structure dialog and select the "Build Types" tab.

2. Select the "app" module in the far left panel and the "release" entry from the middle panel.

3. Change the "Minify Enabled" option from "false" to "true".

4. Follow the steps to build the release APK file.

Known Issues with Revision 2.0a

Section 2.8.1

The path to be entered into the environment variable should read as follows:
;C:\Users\demo\AppData\Local\Android\sdk\platform-tools;
C:\Users\demo\AppData\Local\Android\sdk\tools

Section 17.8

The following lines of code cause an error which reads "Constant and Resource type mismatch":
    myButton.setId(1);
    myEditText.setId(2);
The problem can be resolved by specifying these values as resources using the following steps:

Right click on the app -> res -> values folder, select the New -> Values resource file menu option and name the new resource file id.xml. With the resource file created, edit it so that it reads as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <item name="myButtonId" type="id" />
        <item name="myEditTextId" type="id" />
    </resources>
Edit the JavaActivityLayout.java file and modify the setId calls to reference the new resource values:
    myButton.setId(R.id.myButtonId);
    myEditText.setId(R.id.myEditTextId);
Note that when working with the minimum SDK set to API 17 or later, the generateViewId() method can be used to automatically generate IDs for views avoiding the need to add resource values to the project:
    myButton.setId(myButton.generateViewId());
    myEditText.setId(myEditText.generateViewId());

Section 58.2

The product flavors section of the Gradle file listed in this section incorrectly uses "packageName" instead of "applicationId". This section of the build.Gradle file should read as follows:
    productFlavors {
        phone {
            applicationId "com.ebookfrenzy.buildexample.app.phone"
            versionName "1.0-phone"
        }
        tablet {
            applicationId "com.ebookfrenzy.buildexample.app.tablet"
            versionName "1.0-tablet"
        }
If you have encountered an error in this book not listed above, please let us know by contacting our support team at [email protected]





Featured Titles


$19.99$24.99$19.99$19.99
Add to Cart Add to Cart Add to Cart Add to Cart
Tell me more... Tell me more... Tell me more... Tell me more...

$9.99$9.99$9.99$9.99
Add to Cart Add to Cart Add to Cart Add to Cart
Tell me more... Tell me more... Tell me more... Tell me more...