YAPP-19th / Yumyum-Doctor-Android

커스텀 레시피 공유 앱 냠냠박사 :beverage_box: 🎓
Apache License 2.0
11 stars 1 forks source link

[Bug] 서버에서 가져온 이미지가 load가 안되는 건 #99

Closed ashwon12 closed 2 years ago

ashwon12 commented 2 years ago

bug

서버에서 가져온 imgUrl이 ImageView에 load가 안됩니다.

Log

2022-01-02 01:01:14.197 20262-20262/? W/Glide: Load failed for http://localhost:10000/kkh-bucket/food2022-01-02_00-27-43e1ba15dd-03bb-415e-8aee-2c8605170e01.jpg with size [477x382]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
2022-01-02 01:01:14.197 20262-20262/? I/Glide: Root cause (1 of 1)
    com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:98)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
     Caused by: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:10000
        at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:147)
        at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
        at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
        at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
        at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
        at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
        at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:93)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58) 
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100) 
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70) 
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63) 
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) 
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280) 
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235) 

참고 사항

찾아본 사이트

jionchu commented 2 years ago

서버에서 받아오는 이미지 리소스의 문제인 것 같습니다. 해당 이미지 url로 들어가보면 The resource you requested does not exist라고 뜨네요. 전에 말씀하셨던 http 문제는 아닌 걸 다른 이미지로 테스트해서 확인했습니다.

ashwon12 commented 2 years ago

음 그러면 이 이미지 는 이미지뷰에 잘 그려지나요?

jionchu commented 2 years ago

@ashwon12 네 잘 그려집니다!

ashwon12 commented 2 years ago

게시글 작성하기로 저 이미지 서버에 보낸거 맞죠?!?!

jionchu commented 2 years ago

엇 아니요 glide.load 함수에 넣어서 확인해본 결과입니다

ashwon12 commented 2 years ago

http 문제는 아닌 거 같네용. 저희 서버에서 온 url을 로드할때 문제가 있나봐요,,, 🥲 전달받은 이미지 url로 들어가면 사진 잘 나오는데 왜 그럴까요? ㅠㅠ

jionchu commented 2 years ago

저는 서버에 이미지 저장이 제대로 안되는 것 같습니당,, 레시피 조회하면 이미지 리스트가 비어있네요

ashwon12 commented 2 years ago

@jionchu 😱 혹시 어플리케이션 이미지 퍼미션 허용하셨나요?!

jionchu commented 2 years ago

이미지 url이 localhost로 되어있어서 생기는 문제 같네요. localhost 부분을 10.0.2.2로 바꿔주면 정상적으로 로드 됩니다. 이 부분은 실서버 사용하게 되면 해결될 문제 같습니다!

ashwon12 commented 2 years ago

꺄앍 다행이네요...!