回答編集履歴

1

追記

2019/05/13 07:35

投稿

keicha_hrs
keicha_hrs

スコア6768

test CHANGED
@@ -15,3 +15,105 @@
15
15
 
16
16
 
17
17
  build.gradleに記述された設定は、GUIでもある程度は操作できます。テキストで記述した方が簡単と思うならばテキストで、それができなければGUIだけでも何とかなるかもしれません。ただ、参考書ではテキストで直接編集するように記されているものが多いと思います。
18
+
19
+
20
+
21
+ ---
22
+
23
+
24
+
25
+ (コメントに対する追記)
26
+
27
+
28
+
29
+ > ちなみに、GUIというのは、エミュレータのことでしょうか?
30
+
31
+
32
+
33
+ 違います。
34
+
35
+
36
+
37
+ 実際にプロジェクトを作成してbuild.gradleを開くと、こんな内容になっているでしょう。
38
+
39
+
40
+
41
+ appモジュール用のbuild.gradleの例
42
+
43
+ ```gradle
44
+
45
+ apply plugin: 'com.android.application'
46
+
47
+
48
+
49
+ apply plugin: 'kotlin-android'
50
+
51
+
52
+
53
+ apply plugin: 'kotlin-android-extensions'
54
+
55
+
56
+
57
+ android {
58
+
59
+ compileSdkVersion 28
60
+
61
+ defaultConfig {
62
+
63
+ applicationId "com.example.myapplication"
64
+
65
+ minSdkVersion 15
66
+
67
+ targetSdkVersion 28
68
+
69
+ versionCode 1
70
+
71
+ versionName "1.0"
72
+
73
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
74
+
75
+ }
76
+
77
+ buildTypes {
78
+
79
+ release {
80
+
81
+ minifyEnabled false
82
+
83
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
84
+
85
+ }
86
+
87
+ }
88
+
89
+ }
90
+
91
+
92
+
93
+ dependencies {
94
+
95
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
96
+
97
+ implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
98
+
99
+ implementation 'com.android.support:appcompat-v7:28.0.0'
100
+
101
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
102
+
103
+ testImplementation 'junit:junit:4.12'
104
+
105
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
106
+
107
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
108
+
109
+ }
110
+
111
+ ```
112
+
113
+
114
+
115
+ これをこのエディター上で直接編集してもいいのですが、メニューからFile→Project Structureと選択して開かれるダイアログを用いれば、上記の内容をある程度で編集できるということです。
116
+
117
+
118
+
119
+ ただ、簡単な編集程度であればテキストエディター上で直接編集した方が簡単でしょう。入門書籍でも、「build.gradleのdependenciesブロックにこれこれを追記してください」のような書き方をしているものもあります。