차근차근/안드로이드 스튜디오
gson을 써보려는데...
예쁜꽃이피었으면
2016. 7. 26. 18:06
http://darksilber.tistory.com/entry/GSON-%EC%82%AC%EC%9A%A9%EB%B2%95
compile 'com.google.code.gson:2.3.1' <- 이것 부터 에러가 난다.
- libs에 gson-2.2.4.jar를 넣고
- 우클릭해서 add as library하고
- build.gradle6파일에 compile files('libs/gson-2.2.4.jar')를 하고
- clean build를 해보고 다시 빌드해보세요.
이렇게 했더니 추가 됐다.
gson 인스턴스 선언
Gson gson = new GsonBuilder().create();
를 해야 하는데.. 또 에러
검색어 : cannot resolve symbol gson android studio , gson
build.gradle에
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.3.1'
이렇게 하니까 됨. 위에서 추가한 libs/gson-2.2.4d.jar도 지움
반응형