Open gracegyu opened 2 years ago
이번 naver login 5.0.1 업데이트 이후로 네이버에서 dialog 등을 AppCompat Theme 로 모두 변경하면서 생기는 문제입니다.
android/app/src/main/AndroidManifest.xml 에
...
<activity android:name="com.navercorp.nid.oauth.activity.NidOAuthWebViewActivity"
android:theme="@style/LaunchTheme">
코드를 추가하신뒤
android/app/src/main/res/values/styles.xml 에
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
코드를
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
로 변경하여주시면됩니다.
(@android:style/Theme.Black.NoTitleBar
-> Theme.AppCompat.DayNight.NoActionBar
)
관련 코드는 #57 에서 확인 가능하시며 수정내용을 반영해주시기 바랍니다.
감사합니다.
Theme.AppCompat.DayNight.NoActionBar로 설정하면 아래 에러가 납니다. Theme.AppCompat.Night.NoActionBar로 설정하니 빌드/실행이 되네요. 감사합니다.
FAILURE: Build failed with an exception.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:AAPT: error: resource style/Theme.AppCompat.DayLight.NoActionBar (aka com.vatech.cleverpam:style/Theme.AppCompat.DayLight.NoActionBar) not found. error: failed linking references.
@gracegyu 오류 로그상으로 DayNight가 아닌 DayLight로 쓰신거같긴하지만 ...우선 AppCompat 을 사용하는게 주목적이라 따로 디자인에 문제가 없으시다면 그대로 사용하셔도 될거같습니다. ☺️
감사합니다.
오타을 입력했군요. 확인했습니다. 대단히 감사합니다.
Flutter 2.10.3 사용중입니다!
android>app>src>main>androidmanifest.xml <activity android:name="com.navercorp.nid.oauth.activity.NidOAuthWebViewActivity" android:theme="@style/LaunchTheme"> 추가했고
android>app>src>main>res>values>styles.xml
Flutter v2.10에서 naver login을 접목하고 있습니다. Android에서 로그인이 잘되었는데, 아래코드 호출하면 갑자기 다음의 에러가 뜹니다. Real device에서는 잘되고, Emulator에서만 이 에러가 뜹니다.
NaverLoginResult res = await FlutterNaverLogin.logIn();
I/NaverIdLogin|com.mycompay.myapp|OAuthLoginEncryptedPreferenceManager(21114): access token is expired. E/MethodChannel#flutter_naver_login(21114): Failed to handle method call E/MethodChannel#flutter_naver_login(21114): java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. E/MethodChannel#flutter_naver_login(21114): at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:852) E/MethodChannel#flutter_naver_login(21114): at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:815) E/MethodChannel#flutter_naver_login(21114): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:703) E/MethodChannel#flutter_naver_login(21114): at androidx.appcompat.app.AppCompatDialog.setContentView(AppCompatDialog.java:95) E/MethodChannel#flutter_naver_login(21114): at com.navercorp.nid.progress.NidProgressDialog.init(NidProgressDialog.kt:39) E/MethodChannel#flutter_naver_login(21114): at com.navercorp.nid.progress.NidProgressDialog.(NidProgressDialog.kt:32)
E/MethodChannel#flutter_naver_login(21114): at com.navercorp.nid.oauth.NidOAuthLogin.refreshToken(NidOAuthLogin.kt:196)
E/MethodChannel#flutter_naver_login(21114): at com.navercorp.nid.NaverIdLoginSDK.authenticate(NaverIdLoginSDK.kt:104)
E/MethodChannel#flutter_naver_login(21114): at com.yoonjaepark.flutter_naver_login.FlutterNaverLoginPlugin.login(FlutterNaverLoginPlugin.kt:193)
E/MethodChannel#flutter_naver_login(21114): at com.yoonjaepark.flutter_naver_login.FlutterNaverLoginPlugin.onMethodCall(FlutterNaverLoginPlugin.kt:127)
E/MethodChannel#flutter_naver_login(21114): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#flutter_naver_login(21114): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/MethodChannel#flutter_naver_login(21114): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/MethodChannel#flutter_naver_login(21114): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/MethodChannel#flutter_naver_login(21114): at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#flutter_naver_login(21114): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter_naver_login(21114): at android.os.Looper.loopOnce(Looper.java:201)
E/MethodChannel#flutter_naver_login(21114): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#flutter_naver_login(21114): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#flutter_naver_login(21114): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_naver_login(21114): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#flutter_naver_login(21114): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
I/flutter (21114): error on Naver login: PlatformException(error, You need to use a Theme.AppCompat theme (or descendant) with this activity., null, java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
I/flutter (21114): at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:852)
I/flutter (21114): at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:815)
I/flutter (21114): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:703)
I/flutter (21114): at androidx.appcompat.app.AppCompatDialog.setContentView(AppCompatDialog.java:95)
I/flutter (21114): at com.navercorp.nid.progress.NidProgressDialog.init(NidProgressDialog.kt:39)
I/flutter (21114): at com.navercorp.nid.progress.NidProgressDialog.(NidProgressDialog.kt:32)
I/flutter (21114): at com.navercorp.nid.oauth.NidOAuthLogin.refreshToken(NidOAuthLogin.kt:196)
I/flutter (21114): at com.navercorp.nid.NaverIdLoginSDK.authenticate(NaverIdLoginSDK.kt:104)
I/flutter (21114): at com.yoonjaepark.flutter_naver_login.FlutterNaverLoginPlugin.login(FlutterNaverLoginPlugin.kt:193)
I/flutter (21114): at com.yoonjaepark.flutter_naver_login.FlutterNaverLoginPlugin.onMethodCall(FlutterNaverLoginPlugin.kt:127)
I/flutter (21114): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter (21114): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
I/flutter (21114): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
I/flutter (21114): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
I/flutter (21114): at android.os.Handler.handleCallback(Handler.java:938)
I/flutter (21114): at android.os.Handler.dispatchMessage(Handler.java:99)
I/flutter (21114): at android.os.Looper.loopOnce(Looper.java:201)
I/flutter (21114): at android.os.Looper.loop(Looper.java:288)
I/flutter (21114): at android.app.ActivityThread.main(ActivityThread.java:7839)
I/flutter (21114): at java.lang.reflect.Method.invoke(Native Method)
I/flutter (21114): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
I/flutter (21114): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
I/flutter (21114): )