Expert Android Studio. Dundar Onur

Чтение книги онлайн.

Читать онлайн книгу Expert Android Studio - Dundar Onur страница 10

Expert Android Studio - Dundar Onur

Скачать книгу

rel="nofollow" href="#x_6_i147"> Figure 2.21 is selected. You can also select the Store a snapshot for faster startup option, which will save the last state of the virtual device and load it from disk when it is launched again.

      Depending on your hardware configuration, the emulator may take a while to boot up. The initial bootup will take longer than subsequent launches, which might be close to instantaneous if you have chosen the Store a snapshot for faster startup option.

      You now have a new Android device to play with and it didn't cost you a penny.

      Using ADB

      You have now imported and built your project and created a new Android virtual device. In this section, you learn how to deploy the binary to the virtual device. To do that, you need to know how to connect the two.

Luckily, you won't need to do much; Android Debug Bridge (ADB) will handle all the heavy lifting here. ADB works almost seamlessly to deploy and run your app in a virtual or real device. However, you can always access ADB through your OS's shell and execute commands manually. ADB bridges between your computer and the connected device whether it is a real or a virtual device. Most of the time, you won't need to interact with ADB manually. To use ADB, open a console and type adb. You should see something similar to Listing 2.2 followed by the usage and option details.

LISTING 2.2 : ADB Launch Command

      $ adb

      Android Debug Bridge version 1.0.32

      Revision eac51f2bb6a8-android…

      NOTE

      If the adb command isn't found, you'll have to add it to your system's path. The adb executable is located in the sdk/platform-tools folder.

      Given that the emulator you just created is still running, if you execute adb devices you'll see a list of the devices available over ADB. You can use adb install <apk path> to install a packaged apk to the connected device. However, because the IDE performs this for you, you won't be using the install option extensively.

      Other useful adb options are push and pull. These commands are used to access the device's file system. The following commands will copy a file from your computer to the device and from your device to the computer:

      $ adb push <local> <remote>

      $ adb pull <remote> <local>

MIGRATING PROJECTS FROM ECLIPSE

      Eclipse ADT and Android Studio have very different project structures and configurations, but importing projects from Eclipse to Android Studio is very straightforward in most cases.

      The first option for migrating your Eclipse project to IntelliJ is to import the project into Android Studio.

      1. Select File ⇨ New ⇨ Import Project as shown in Figure 2.23.

Start migrating from Eclipse screenshot.

Figure 2.23 Start migrating from Eclipse

      2. Navigate through your Eclipse project folder and click OK, as shown in Figure 2.24.

Select project path to import screenshot.

Figure 2.24 Select project path to import

      The IDE will create the necessary files, including Gradle files, and set up your project.

      Once the import is complete, import-summary.txt will be shown, which displays the results of the migration.

      Another way to migrate your project is to export the project from Eclipse. To export from Eclipse, your ADT plugins should be up-to-date.

      Конец ознакомительного фрагмента.

      Текст предоставлен ООО «ЛитРес».

      Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.

      Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.

iVBORw0KGgoAAAANSUhEUgAAAFQAAABeCAMAAACKLsOVAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmN

Скачать книгу