質問編集履歴

2

build.gradleをapp下とproject下の二つを記載

2018/08/19 08:01

投稿

hama1185
hama1185

スコア18

test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,77 @@
42
42
 
43
43
 
44
44
 
45
+ ```app/bulid.gradle
46
+
47
+ apply plugin: 'com.android.application'
48
+
49
+
50
+
51
+ apply plugin: 'kotlin-android'
52
+
53
+
54
+
55
+ apply plugin: 'kotlin-android-extensions'
56
+
57
+
58
+
45
- ```gradle
59
+ android {
60
+
61
+ compileSdkVersion 28
62
+
63
+ defaultConfig {
64
+
65
+ applicationId "hamataku.example.com.myapplication"
66
+
67
+ minSdkVersion 24
68
+
69
+ targetSdkVersion 28
70
+
71
+ versionCode 1
72
+
73
+ versionName "1.0"
74
+
75
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
76
+
77
+ }
78
+
79
+ buildTypes {
80
+
81
+ release {
82
+
83
+ minifyEnabled false
84
+
85
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
86
+
87
+ }
88
+
89
+ }
90
+
91
+
92
+
93
+ }
94
+
95
+
96
+
97
+ dependencies {
98
+
99
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
100
+
101
+ implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
102
+
103
+ implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
104
+
105
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
106
+
107
+ testImplementation 'junit:junit:4.12'
108
+
109
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
110
+
111
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
112
+
113
+ implementation 'com.beust:klaxon:3.0.1'
114
+
115
+ }
46
116
 
47
117
  repositories {
48
118
 
@@ -52,31 +122,69 @@
52
122
 
53
123
 
54
124
 
125
+ }
126
+
127
+ ```
128
+
129
+ ```project/build.gradle
130
+
131
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
132
+
133
+
134
+
135
+ buildscript {
136
+
137
+ ext.kotlin_version = '1.2.60'
138
+
139
+ repositories {
140
+
141
+ google()
142
+
143
+ jcenter()
144
+
145
+ }
146
+
55
- dependencies {
147
+ dependencies {
56
-
148
+
57
- implementation fileTree(dir: 'libs', include: ['*.jar'])
149
+ classpath 'com.android.tools.build:gradle:3.1.4'
58
-
150
+
59
- implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
151
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
60
-
61
- implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
152
+
62
-
63
- implementation 'com.android.support.constraint:constraint-layout:1.1.2'
153
+
64
-
65
- testImplementation 'junit:junit:4.12'
154
+
66
-
67
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
155
+
68
-
156
+
69
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
157
+ // NOTE: Do not place your application dependencies here; they belong
70
-
158
+
71
- implementation 'com.beust:klaxon:3.0.1'
159
+ // in the individual module build.gradle files
72
-
73
-
74
-
160
+
75
- }
161
+ }
162
+
76
-
163
+ }
164
+
165
+
166
+
167
+ allprojects {
168
+
169
+ repositories {
170
+
171
+ google()
172
+
173
+ jcenter()
174
+
175
+ }
176
+
177
+ }
178
+
179
+
180
+
181
+ task clean(type: Delete) {
182
+
183
+ delete rootProject.buildDir
184
+
185
+ }
186
+
77
- ```
187
+ ```
78
-
79
-
80
188
 
81
189
  ### 試したこと
82
190
 

1

言語をgradleではなくkotlinと表記していたこと app下のgradleに記入したがエラーが発生した

2018/08/19 08:01

投稿

hama1185
hama1185

スコア18

test CHANGED
File without changes
test CHANGED
@@ -10,11 +10,27 @@
10
10
 
11
11
  ### 発生している問題・エラーメッセージ
12
12
 
13
- いつも外部イブラリの実装は
13
+ app下のgradleを変更したがエーが発生しました。
14
14
 
15
15
  ```
16
16
 
17
+ Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.beust:klaxon:3.0.1.
18
+
19
+
20
+
17
- Could not find method implementation() for arguments [com.beust:klaxon:3.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
21
+ Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.beust:klaxon:3.0.1.
22
+
23
+
24
+
25
+ Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.beust:klaxon:3.0.1.
26
+
27
+
28
+
29
+ Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.beust:klaxon:3.0.1.
30
+
31
+
32
+
33
+ Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.beust:klaxon:3.0.1.
18
34
 
19
35
 
20
36
 
@@ -26,65 +42,37 @@
26
42
 
27
43
 
28
44
 
29
- ```kotlin
45
+ ```gradle
30
46
 
31
- buildscript {
47
+ repositories {
32
48
 
33
- ext.kotlin_version = '1.2.60'
34
-
35
- repositories {
36
-
37
- google()
38
-
39
- jcenter()
49
+ jcenter()
40
-
41
- }
42
-
43
- dependencies {
44
-
45
- classpath 'com.android.tools.build:gradle:3.1.4'
46
-
47
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
48
-
49
-
50
-
51
- implementation 'com.beust:klaxon:3.0.1'
52
-
53
-
54
-
55
-
56
-
57
- // NOTE: Do not place your application dependencies here; they belong
58
-
59
- // in the individual module build.gradle files
60
-
61
- }
62
50
 
63
51
  }
64
52
 
65
53
 
66
54
 
67
- allprojects {
55
+ dependencies {
68
56
 
69
- repositories {
57
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
70
58
 
71
- google()
59
+ implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72
60
 
73
- jcenter()
61
+ implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
74
62
 
75
- }
63
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
76
64
 
77
- }
65
+ testImplementation 'junit:junit:4.12'
66
+
67
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
68
+
69
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
70
+
71
+ implementation 'com.beust:klaxon:3.0.1'
78
72
 
79
73
 
80
74
 
81
- task clean(type: Delete) {
82
-
83
- delete rootProject.buildDir
84
-
85
75
  }
86
-
87
-
88
76
 
89
77
  ```
90
78