質問編集履歴

2

エラー内容追記

2020/06/30 23:49

投稿

yu9718s
yu9718s

スコア9

test CHANGED
File without changes
test CHANGED
@@ -159,3 +159,51 @@
159
159
  初期化するために私の試したコードは何が間違っているのでしょうか
160
160
 
161
161
  どなたかご教示お願いいたします。
162
+
163
+
164
+
165
+ ```エラー追記
166
+
167
+ E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1
168
+
169
+ Process: jp.co.stv_tech.test_download_2, PID: 2831
170
+
171
+ java.lang.RuntimeException: An error occurred while executing doInBackground()
172
+
173
+ at androidx.loader.content.ModernAsyncTask$3.done(ModernAsyncTask.java:164)
174
+
175
+ at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
176
+
177
+ at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
178
+
179
+ at java.util.concurrent.FutureTask.run(FutureTask.java:271)
180
+
181
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
182
+
183
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
184
+
185
+ at java.lang.Thread.run(Thread.java:764)
186
+
187
+ Caused by: kotlin.UninitializedPropertyAccessException: lateinit property urlConnection has not been initialized
188
+
189
+ at jp.co.stv_tech.test_download_2.GetImage.loadInBackground(GetImage.kt:38)
190
+
191
+ at jp.co.stv_tech.test_download_2.GetImage.loadInBackground(GetImage.kt:11)
192
+
193
+ at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
194
+
195
+ at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
196
+
197
+ at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
198
+
199
+ at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
200
+
201
+ at java.util.concurrent.FutureTask.run(FutureTask.java:266)
202
+
203
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
204
+
205
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
206
+
207
+ at java.lang.Thread.run(Thread.java:764) 
208
+
209
+ ```

1

質問対応

2020/06/30 23:49

投稿

yu9718s
yu9718s

スコア9

test CHANGED
File without changes
test CHANGED
@@ -90,6 +90,52 @@
90
90
 
91
91
  ```
92
92
 
93
+ ```エラー内容
94
+
95
+ E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1
96
+
97
+ Process: jp.co.stv_tech.test_download_2, PID: 4116
98
+
99
+ java.lang.RuntimeException: An error occurred while executing doInBackground()
100
+
101
+ at androidx.loader.content.ModernAsyncTask$3.done(ModernAsyncTask.java:164)
102
+
103
+ at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
104
+
105
+ at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
106
+
107
+ at java.util.concurrent.FutureTask.run(FutureTask.java:242)
108
+
109
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
110
+
111
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
112
+
113
+ at java.lang.Thread.run(Thread.java:762)
114
+
115
+ Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.net.HttpURLConnection
116
+
117
+ at jp.co.stv_tech.test_download_2.GetImage.loadInBackground(GetImage.kt:16)
118
+
119
+ at jp.co.stv_tech.test_download_2.GetImage.loadInBackground(GetImage.kt:11)
120
+
121
+ at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
122
+
123
+ at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
124
+
125
+ at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
126
+
127
+ at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
128
+
129
+ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
130
+
131
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
132
+
133
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
134
+
135
+ at java.lang.Thread.run(Thread.java:762) 
136
+
137
+ ```
138
+
93
139
 
94
140
 
95
141
  ### 試したこと