fluttercandies / flutter_ali_auth

Flutter Ali Auth Plugin 阿里云一键登录Flutter插件
https://pub.flutter-io.cn/packages/flutter_ali_auth
MIT License
49 stars 16 forks source link

[Bug report] 初始化SDK出现错误:PlatformException(600017, 初始化失败,sdk为空, null, null) #7

Closed dcupivnjyft191 closed 1 year ago

dcupivnjyft191 commented 1 year ago

Version

0.5.0

Platforms

Android

Device Model

Android 12

flutter info

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [版本 10.0.19045.2673], locale zh-CN)
    • Flutter version 3.3.10 on channel stable at D:\Program Files\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (3 months ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at D:\Program Files\android_sdk
    • Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
    • ANDROID_HOME = D:\Program Files\android_sdk
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

How to reproduce?

您好,我从较早的0.4.0版本升级到0.5.0后,初始化SDK报错。 错误信息: 初始化SDK出现错误:PlatformException(600017, 初始化失败,sdk为空, null, null)

在initSdk打印中是可以看到androidSdk的,但是我查看了getAndroidSdk()函数,获取到的值是null。请问是什么原因导致的?

initSdk: {"iosSdk":"","logoImage":"images/flutter_candies_logo.png","authUIStyle":0,"logoIsHidden":false,"sloganText":"欢迎登录FlutterCandies","enableLog":true,"prefersStatusBarHidden":false,"androidSdk":"PPXTyCnLS+kBI9vTr/CGwZGgPp7XYDEUgNQRt5LGnx0StLy5hcAT+fDn3nLj5RQZHi4eljK3zKAoF4GTJP85vqp23a6uShnjNR8Q2LLn0*************************************************************************************************","navColor":"#00bcd4"}

Logs

No response

Example code (optional)

初始化SDK代码如下:

  AuthConfig _authConfig = AuthConfig(
    iosSdk: "",
    androidSdk:   "PPXTyCnLS+kBI9vTr/CGwZGgPp7XYDEUgNQRt5LGnx0StLy5hcAT+fDn3nLj5RQZHi4eljK3zKAoF4GTJP85vqp23a6uShnjNR8Q2LLn0*************************************************************************************************"",
    enableLog: true,
    authUIStyle: AuthUIStyle.fullScreen,
    authUIConfig: FullScreenUIConfig(
      navConfig: NavConfig(navColor: Colors.cyan.toHex()),
      logoConfig: const LogoConfig(
        logoIsHidden: false,
        logoImage: "images/flutter_candies_logo.png",
      ),
      sloganConfig: const SloganConfig(sloganText: '欢迎登录FlutterCandies'),
    ),
  );

Contact

No response

ManInTheWind commented 1 year ago

你再仔细检查一下你的代码或补充支持资料,我这边是没有问题的。 image

dcupivnjyft191 commented 1 year ago

你再仔细检查一下你的代码或补充支持资料,我这边是没有问题的。 image

上面写错了,之前的版本是0.1.0,我测试撤回0.1.0就是正确的,可以正常初始化和弹窗。升级到更新的任何一个版本都不行。使用example编译,可以正常初始化SDK,但是弹窗显示超时。但是把example的代码放入到我的工程里面,也是无法初始化SDK,不知道是不是什么库冲突导致了。

ManInTheWind commented 1 year ago

清除缓存,更新到0.6.0。

dcupivnjyft191 commented 1 year ago

清除缓存,更新到0.6.0。

好的,非常感谢!问题已经解决。SDK初始化失败是由于混淆导致的。proguard-rules.pro中增加排除后解决。

-keep class com.fluttercandies.flutter_ali_auth.** { *; }