기본 콘텐츠로 건너뛰기

안드로이드 앱 만들기 : 소셜 로그인의 오류 ???(카카오톡 로그인, 네이버 로그인, 코드 난독화 등등)


원본출처: 티스토리 바로가기
Caused by com.google.crypto.tink.shaded.protobuf.z Protocol message contained an invalid tag (zero).

 

앱을 구현하고 있는 동안에 소셜 로그인을 지원해 달라는 요청으로 앱에 소셜 로그인을 달았습니다. 

로그인 화면

그러던 어느 날 인가 로그인이 되지 않습니다. android 13 이후로부터 보안이 강화되었기도 하고  안드로이드 스튜디오의 버전이 올라가기도 했고요.

 

Android Studio Giraffe | 2022.3.1
Build #AI-223.8836.35.2231.10406996, built on June 29, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Registry:
    external.system.auto.import.disabled=true
    debugger.new.tool.window.layout=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.instant.shutdown=false
    ide.experimental.ui=true

Non-Bundled Plugins:
    com.jetbrains.kmm (0.6.1(223)-18)
    org.jetbrains.compose.desktop.ide (1.4.3)

 

그러면서 gradle 버전도 8.1.0 이 되었고 kotlin 도 버전이 1.8.22 이상으로 패치가 진행되었습니다.   그러다 보니 이제 보안이 점점 더 강화되는 느낌이기도 합니다. 

 

minifyEnabled true shrinkResources true

구글에서는 코드 난독화나 앱의 크기를 줄이는 방안으로 압축을 요구하기도 합니다. 그러는 동안에 발생하는 이슈들은 전부다 개발자의 몫이 되기도 합니다. 

 

오늘은 그중에 소셜 로그인이 되지 않는 현상 (네이버로그인, 카카오톡 로그인 이 안돼요) 이 발생한 앱을 조치한 방법을 기술해 두고자 합니다. 

 

https://developers.naver.com/forum/posts/32767

 

개발자 포럼 - NAVER Developers

 

developers.naver.com

https://devtalk.kakao.com/t/kakao-sdk-login/108246

 

Kakao sdk login 시 크래쉬가 발생합니다

안녕하세요, 카카오 sdk 로그인 기능을 사용하는 도중 크래쉬가 발생해서 질문 남깁니다. 현재 카카오 톡으로 로그인하기와 카카오 계정으로 로그인하기 두가지를 사용하고 있는데요, LoginClient.i

devtalk.kakao.com

검색을 통해 이런저런 이슈가 있음을 알게 되었습니다. 

 

이런 검색 결과를 통해서 다음과 같은 수정을 진행했습니다.  아래 내용은 proguard-rules.pro 파일에 추가한 내용입니다.

# kakao minifyReleaseWithR8  2023.08.10 ~ -keep interface com.kakao.sdk.**.*Api  # Please add these rules to your existing keep rules in order to suppress warnings. # This is generated automatically by the Android Gradle plugin. -dontwarn org.bouncycastle.jsse.BCSSLParameters -dontwarn org.bouncycastle.jsse.BCSSLSocket -dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider -dontwarn org.conscrypt.Conscrypt$Version -dontwarn org.conscrypt.Conscrypt -dontwarn org.conscrypt.ConscryptHostnameVerifier -dontwarn org.openjsse.javax.net.ssl.SSLParameters -dontwarn org.openjsse.javax.net.ssl.SSLSocket -dontwarn org.openjsse.net.ssl.OpenJSSE -dontwarn org.slf4j.impl.StaticLoggerBinder  # naver login 2023.08.10 ~ # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and # EnclosingMethod is required to use InnerClasses. -keepattributes Signature, InnerClasses, EnclosingMethod  # Retrofit does reflection on method and parameter annotations. -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations  # Keep annotation default values (e.g., retrofit2.http.Field.encoded). -keepattributes AnnotationDefault  # Retain service method parameters when optimizing. -keepclassmembers,allowshrinking,allowobfuscation interface * {     @retrofit2.http.* <methods>; }  # Ignore annotation used for build tooling. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement  # Ignore JSR 305 annotations for embedding nullability information. -dontwarn javax.annotation.**  # Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. -dontwarn kotlin.Unit  # Top-level functions that can only be used by Kotlin. -dontwarn retrofit2.KotlinExtensions -dontwarn retrofit2.KotlinExtensions$*  # With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy # and replaces all potential values with null. Explicitly keeping the interfaces prevents this. -if interface * { @retrofit2.http.* <methods>; } -keep,allowobfuscation interface <1>  # Keep inherited services. -if interface * { @retrofit2.http.* <methods>; } -keep,allowobfuscation interface * extends <1>  # Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). -keep,allowobfuscation,allowshrinking interface retrofit2.Call -keep,allowobfuscation,allowshrinking class retrofit2.Response  # With R8 full mode generic signatures are stripped for classes that are not # kept. Suspend functions are wrapped in continuations where the type argument # is used. -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

 

이제 이것으로 앱을 빌드하여 릴리즈를 해 볼 예정입니다.   다른 이슈를 알게 되면 또 기술해 보겠습니다.

 

쿠팡링크 쿠팡와우 로켓프래쉬 로켓패션
이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

댓글

이 블로그의 인기 게시물

개인정보처리방침 안내

 billcoreaTech('https://billcoreatech.blogspot.com/'이하 'https://billcoreatech.blogspot')은(는) 「개인정보 보호법」 제30조에 따라 정보주체의 개인정보를 보호하고 이와 관련한 고충을 신속하고 원활하게 처리할 수 있도록 하기 위하여 다음과 같이 개인정보 처리방침을 수립·공개합니다. ○ 이 개인정보처리방침은 2021년 8월 26부터 적용됩니다. 제1조(개인정보의 처리 목적) billcoreaTech('https://billcoreatech.blogspot.com/'이하 'https://billcoreatech.blogspot')은(는) 다음의 목적을 위하여 개인정보를 처리합니다. 처리하고 있는 개인정보는 다음의 목적 이외의 용도로는 이용되지 않으며 이용 목적이 변경되는 경우에는 「개인정보 보호법」 제18조에 따라 별도의 동의를 받는 등 필요한 조치를 이행할 예정입니다. 1. 서비스 제공 맞춤서비스 제공을 목적으로 개인정보를 처리합니다. 제2조(개인정보의 처리 및 보유 기간) ① billcoreaTech은(는) 법령에 따른 개인정보 보유·이용기간 또는 정보주체로부터 개인정보를 수집 시에 동의받은 개인정보 보유·이용기간 내에서 개인정보를 처리·보유합니다. ② 각각의 개인정보 처리 및 보유 기간은 다음과 같습니다. 1.<서비스 제공> <서비스 제공>와 관련한 개인정보는 수집.이용에 관한 동의일로부터<사용자의 설정시간>까지 위 이용목적을 위하여 보유.이용됩니다. 보유근거 : 앱의 기본기능 활용에 필요한 위치정보 제3조(개인정보의 제3자 제공) ① billcoreaTech은(는) 개인정보를 제1조(개인정보의 처리 목적)에서 명시한 범위 내에서만 처리하며, 정보주체의 동의, 법률의 특별한 규정 등 「개인정보 보호법」 제17조 및 제18조에 해당하는 경우에만 개인정보를 제3자에게 제공합니다. ② billcoreaTech

안드로이드 앱 만들기 : jetpack compose URL 에서 image 받아와서 보여 주기 (feat coil)

원본출처: 티스토리 바로가기 샘플 이미지 오늘은 앱을 만들면서 이미지를 보여 주어야 하는 경우 중에  URL에서 이미지를 가져와 보는 것에 대해서 기술해 보겠습니다.  URL에서 image를 가져온다는 것은 서버에 저장된 image 일수도 있고, SNS profile의 image 정보일수도 있을 것입니다.    구글에서 찾아보면 다른 것들도 많이 있기는 합니다.  그 중에서 coil 라이브러리를 이용해서 한번 만들어 보도록 하겠습니다.    gradle 설정 그래들 설정은 아래 한 줄입니다. 현재 시점에서 최신 버전인 것으로 보입니다.  이 글을 보시는 시점에 최신 버전이 아니라면 아마도 android studio는 추천을 해 줍니다. // image load from url implementation("io.coil-kt:coil-compose:2.2.2")   manaifest  설정 당연한 이야기 겠지만, url에서 이미지를 받아 와야 하기 때문에 권한 설정을 해야 합니다. 또한 인터넷에서 자료를 받아 오는 것은 지연이 발생할 수 있기 때문에 application에서도 다음 문구의 추가가 필요합니다.  <uses-permission android:name="android.permission.INTERNET" /> <application ... android:networkSecurityConfig="@xml/network_config" ... /> 이 설정을 하게 되면 xml 파일을 하나 추가해 주면 됩니다.  network_config.xml 이라는 이름으로 말입니다.  <?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextT