Learn more. Ask Question. Asked 10 years, 9 months ago. Active 3 years, 7 months ago. Viewed k times. Peter O. Yochai Timmer Yochai Timmer This is a perfectly good StackOverflow question.
Add a comment. Active Oldest Votes. Choose the android version. Now you can write your program. Double click the new device to choose it. Press OK.
You're ready to run the program. Excellent guide! You should also add to make sure the Android plugins are installed in IntelliJ. Show 6 more comments. The 5th step in "New Project' has apparently changed slightly since. Add new Sdk c. Jeremy Jeremy 3 3 silver badges 2 2 bronze badges. It is a collection of libraries and compiler which will run the java code on the system.
Visit this link to download the JDK file that is compatible with your computer system. Click here to head to a guide uniquely curated by our experts with the aim to make you industry ready in no time!
The SDK tools are necessary for writing program codes and it also helps in testing the code files. These features guarantee a smooth flow of the development process. Choose the appropriate SDK tool package and click on the package name. Let the command prompt fetch and download any required file.
Accept the terms and conditions if asked. Download the. Select both components i. Review the SDK folder path, download size and click Next , wait till the setup download all files then click Finish. Step 6: Create the First application Once all configuration has been done, the IDE is all set to develop android applications. Select the desired activity template for a simple Hello World application, Empty Activity has been selected. Provide a name to the application, select project location from file explorer, and choose the desired language as well as minimum SDK version, click on Finish.
The IDE will take some time to load the gradel files for the application. After completion, the source code will appear on the screen.
To preview what your layout looks like on different devices, select another device from the device list:. Although our sample application is fully functional at this point, it does not support any form of interaction yet. Let's modify it to support tap events. MainActivity is not a very meaningful class name, so let's rename it. In the dialog that opens, change the class name HelloDroidActivity and click Refactor :.
All references to this class will be updated automatically, and your application's source code will look as follows:. Replace the code in HelloDroid. Note that the identifiers we've used in the source code correspond to those we've set in our layout definition file, otherwise our code would not work.
First of all, to be able to run our application, we need to configure a virtual device. On the first step of the wizard, click Create Virtual Device :.
On the next step, we need to select the hardware that our virtual device will emulate. Let's select Phone on the left, and choose Pixel 2 as the target device:.
Click the Download link next to the system image you want to mimic on the virtual device. For this tutorial, we've chosen to download the R system image. In the License Agreement dialog that opens, read the license agreement and accept it, then click Next and wait for the download to finish. When the system image has been downloaded, select it and click Next in the System Image step of the wizard. On the last step, you can modify your virtual device name and select the startup size and orientation of the screen.
Choose the portrait layout and click Finish :. The newly configured device appears in the Android Virtual Device Manager.
On the main IntelliJ IDEA toolbar, make sure the automatically created Run configuration and the virtual device we've just configured are selected and click :. The Android emulator will launch after the build has successfully finished, with our application started:.
Click the droid image and see how the application processes the tap events, counts them and returns the corresponding message:. Tutorial: Create your first Android application In this tutorial, we will create a simple yet fully-functional Android application that counts how many times you tap a droid image.
Optionally, modify the location for the Android SDK, and click Next : Review the installation settings and click Finish to start the download: When all components have been downloaded and installed, click Finish : Select Empty Activity as the project template: On the last step, type HelloDroid as the project name and select Java as the language: Configure project JDK Now that we have created our first project, let's make sure it uses the correct JDK. Note that it hides project files and directories that you don't commonly use to see them, choose the Project view : The app folder consists of the following subfolders: manifests : contains the AndroidManifest.
By default, IntelliJ IDEA provides a graphical view of the layout file, but you can also switch to the source code view, or view the text and the graphical representation side by side - use the icons in the top-right corner of the UI Designer pane: This pane shows a rectangular canvas that is synchronized with the layout definition and with the Component Tree , so any changes to the canvas are reflected there accordingly.
To eliminate distraction and only see how your layout is represented, click the Select Design Surface icon in the top-left corner and choose Design : Now let's delete the existing text element.
Now the UI layout looks like the following, and we are ready to start designing the layout of our application: Add image to the UI layout Now let's add a droid image to our layout. In the Pick a Resource dialog that opens, choose the resource file you've added and click OK : Next, we need to modify the default id of the imageView element to be able to reference it later.
0コメント