Introduction to kotlin for iOS developers ③-About gradle

I was planning to write about Gradle, but before that ...

Let's talk a little about the screen This is the screen of Android Studio スクリーンショット 2017-03-08 22.17.12.png

This is the Xcode screen スクリーンショット 2017-03-09 14.07.40.png The two screenshots look pretty much the same, but the problem is how to open the sidebar and the console screen below. In the case of Xcode, the familiar upper right スクリーンショット 2017-03-09 14.22.59.png So you can open and close it, For Android Studio スクリーンショット 2017-03-09 14.25.04.png If you look closely, you can see that the letters are written on the edge of the window. In the image above, the word Project is now pressed, and as a result, the navigation bar appears on the left side. It is recommended that you press all the buttons on the edge of the screen that are a little difficult to understand like this.

So, about Gradle of the main subject

To be honest, I don't understand the essential part either. It seems that it is one of the so-called "build tools", and somehow it is recognized as "auxiliary when building". The experience I have actually rewritten and used is when installing plug-ins and the like. So I think, "I think it's like CocoaPods in Xcode." Well, basically I don't mess with it, but I'm guessing that it may have a meaning like AppDelegate in the sense that it's a problem if I don't.

For the time being, let's rewrite Gradle

Well, it's also called evidence rather than theory, so for the time being, let's put Realm in the My Application I made last time. (For details, see Realm Java Site.) Quoted from Realm Java site

Step 1: Add the following classpath settings to the build.gradle file at the top level of your project.

There is, and the build.gradle to be changed is displayed in the image below it, but is the order of the files the same? スクリーンショット 2017-03-09 14.48.19.png

If they are different, you will be confused as to which of the two build.gradle to rewrite first. スクリーンショット 2017-03-09 14.48.38.png Here is the same sequence as the images on Realm Java. How to sort

スクリーンショット 2017-03-09 14.54.51.png

You'll see a small black triangle at the top of the navigation bar. Just click on it and select Project. Let's actually rewrite it.

スクリーンショット 2017-03-09 14.58.36.png A message will appear at the top of the code screen. The content is "Since Gradle has been rewritten, please synchronize." Gradle will always ask you to sync if even a single character changes. Well, if you have decided what to rewrite, you can synchronize at the end, but I'm curious, so I try to synchronize every time this message appears. Quoted from the same site

Step 2: Apply the realm-android plugin in your application level build.gradle file.

スクリーンショット 2017-03-09 15.05.20.png

Realm is now installed

I will actually write a model of Realm

スクリーンショット 2017-03-09 15.18.51.png

I don't get an error when I import RealmObject. Now you can use Realm.

You can use Gradle like this.

Up to here for this time. Next, I'll do a little bit about molds.

Please also include other articles

Introduction to kotlin for iOS developers ①-Environment construction Introduction to kotlin for iOS developers (2) -Project creation Introduction to kotlin for iOS developers ③-About gradle Introduction to kotlin for iOS developers ④-Type [Introduction to kotlin for iOS developers ⑤-Practical XML] (http://qiita.com/parappa1002/items/867c5b30055312e74fdb) [Introduction to kotlin for iOS developers ⑥-kotlin creation] (http://qiita.com/parappa1002/items/9f898feb4f83e672b384)

Recommended Posts

Introduction to kotlin for iOS developers ③-About gradle
Introduction to kotlin for iOS developers ⑥-Kotlin creation
Introduction to kotlin for iOS developers ④-Type
Introduction to kotlin for iOS developers ⑤-Practical XML
Introduction to kotlin for iOS developers ①-Environment construction
Introduction to kotlin for iOS developers ②-Project creation
About Popover fix for iOS 13
Find out about annotationProcessor for Gradle 5.0
[Introduction to Java] About lambda expressions
Kotlin Class to send to Java developers
Introduction to Programming for College Students: Introduction
Generics of Kotlin for Java developers
Try "Introduction to Vert.x" on Gradle
About Kotlin
Kotlin Class part.2 to send to Java developers
Introduction to java for the first time # 2
About the procedure for java to work
Kotlin scope functions to send to Java developers
Interoperability tips with Kotlin for Java developers
Needed for iOS 14? How to set NSUserTrackingUsageDescription
Memo for migration from java to kotlin
[Introduction to Java] About iterative processing (while, do-while, for, extension for, break, continue)
Kotlin functions and lambdas to send to Java developers
[Introduction to Java] About type conversion (cast, promotion)
Initial settings for rewriting Java projects to Kotlin
[Note] About the introduction to Swift practice Chapter 11
An introduction to Groovy for tedious Java engineers
[Introduction to Java] Basics of java arithmetic (for beginners)
Introduction to Ruby 2
Introduction to SWING
Introduction to web3j
Introduction to Micronaut 1 ~ Introduction ~
[Java] Introduction to Java
Introduction to migration
Introduction to java
Introduction to Doma
How to build docker environment with Gradle for intelliJ
Introduction to Java for beginners Basic knowledge of Java language ①
Introduction to Programming for College Students: Making a Canvas
How to install Gradle and Kotlin with SDKMAN (Mac)
How to study kotlin for the first time ~ Part 2 ~
How to study kotlin for the first time ~ Part 1 ~