1. MAC 터미널 실행 후, 상단 메뉴의 [쉘] -> [새로운 원격 연결 ...] 클릭

 

2. 서비스의 ssh선택 후, 서버 영역의 [+] 버튼 클릭하여 접속하고자 하는 원격 서버의 IP와 포트번호를 입력

 

3. 사용자 계정을 입력하고 연결

 

4. 입력 계정의 비밀번호 입력 후, 접속 확인

1. 발생 상황

Retrofit2를 사용하여 Rest통신을 하려고 할 때, 웹 서버에 접근을 못 한다고 이와 같은 에러가 발생했다!

Call error: CLEARTEXT communication to xxx.xxx.xx not permitted by network security policy

 

 

2. 발생 원인

사용하고자 하는 API주소, 이미지주소 등 네트워크 경로가 https가 아닌 http로 되어 있기 때문에 발생한 문제라고 한다.

 

 

3. 해결 방법

1. 가장 쉬운 방법은 사용하는 네트워크 주소를 https로 변경하는 것이다.

 

2. 하지만, 사용하고자 하는 서버가 https로 구성되어 있지 않은 경우에는 아래 두 가지 방법 중 하나를 적용하면 된다.

 

2-1. network_security_config.xml 파일 생성 후, AndroidManifast.xml 에 등록하기 

 

res/xml 디렉터리에 network_security_config.xml 파일을 만들어 준다.

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">xxx.xxx.xxx</domain>
    </domain-config>
</network-security-config>

그리고 Manifast에 해당 파일을 config 파일로 지정한다.

<application    
		...    
    android:networkSecurityConfig="@xml/network_security_config">

 

 

2-2. AndroidManifast.xmlusesCleartextTraffic 속성 설정

 

<application    
		...    
    android:usesCleartextTraffic="true">

 

 


참고자료

https://gun0912.tistory.com/80

1. 발생 상황

Mac 안드로이드 스튜디오에서 Private 프로젝트를 Pull하는 상황에서 해당 문제가 발생했다.

unable to read askpass response from '프로젝트 경로' 
could not read Username for 'https://github.com': Device not configured

 

 

2. 발생 원인

This commonly happens in an environment where you are invoking git from some sort of gui tool and no appropriate credentials helper has been configured.

번역을 해보면 GUI도구에서 Git을 호출하고 적절한 자격 증명 도우미가 구성되지 않은 환경에서 일반적으로 발생할 수 있는 에러라고 한다.

 

 

3. 해결 방법

1. Android Preference > Version Control > GitHub

 

안드로이드 프로젝트에 연결해 놓은 계정을 확인해 보니, 이 전에 발급받은 Token이 만료되어서 Bad Credencial 표시가 되어 있었다. 그래서 일단 Git 계정을 다시 등록하고 체크 아이콘으로 Default 계정 설정을 해줬다.

 



 

2. Android Preference > Version Control > Git

 

하단에 있는 Use credential helper 를 체크해줬다. 안드로이드 스튜디오를 재실행하고 프로젝트를 정상적으로 PULL할 수 있었다.

 

 


참고자료

https://stackoverflow.com/questions/40274484/fatal-could-not-read-username-for-https-github-com-device-not-configured

1. 발생 상황

private val moshi = Moshi.Builder()
    .add(KotlinJsonAdapterFactory())
    .build()

private val retrofit = Retrofit.Builder()
    .addConverterFactory(MoshiConverterFactory.create(moshi))
    .baseUrl(BASE_URL)
    .build()

REST 통신으로 웹 서버에서 받은 JSON 데이터를 받아서 안드로이드 Moshi 라이브러리로 사용하고자 할 때, 아래와 같은 에러가 발생했다!

Use jsonreader.setlenient(true) to accept malformed json at path $[0].null

 

 

2. 발생 원인

열심히 구글링을 해본 결과...

Retrofit 빌드할 때 사용한 라이브러리로 JSON 데이터를 사용할 수 없을 때 발생하는 에러라고 한다.

 

 

3. 해결 방법

  • Moshi로 Retrofit을 빌드하는 경우 : asLenient()
private val moshi = Moshi.Builder()
    .add(KotlinJsonAdapterFactory())
    .build()

private val retrofit = Retrofit.Builder()
    .addConverterFactory(MoshiConverterFactory.create(moshi).asLenient())
    .baseUrl(BASE_URL)
    .build()

 

  • GSON으로 Retrofit을 빌드하는 경우 : setLenient()
private val gson : Gson = GsonBuilder()
    .setLenient()
    .create()

private val retrofit = Retrofit.Builder()
    .baseUrl(API_URL)
    .client(client)
    .addConverterFactory(GsonConverterFactory.create(gson))
    .build()

 


참고자료

https://github.com/square/moshi/issues/132

https://bacassf.tistory.com/103

취업준비 하던 시기에 github.io로 작업해 놓은 블로그가 있지만, 

아무래도 블로그에 글을 올리려면 마크다운 문서를 작성해서 git으로 작업을 해줘야 하기 때문에

취업 하고 나서는 블로그에 글을 정말 1도 올리지 않았다...ㅎㅎ

 

구글링 하면서 정보를 확인할 수 있는 블로그는 대부분 티스토리 였고,

나도 누군가에게 도움이 되는 포스트를 작성하고 공유하고 싶다는 생각이 들어서

접근성이 좋고 관리하기 편한 티스토리로 블로그를 이전하게 되었다!

 

이제...좀 부지런하게 포스트를 올려야겠다ㅎㅎ

+ Recent posts