当前位置:   article > 正文

记录flutter项目报错及解决办法_failed to get fis auth token

failed to get fis auth token

1.https证书问题,之前请求接口域名证书是dv证书,更换的新域名配置了泛域名证书,导致dio证书验证出错

:DioError [DioErrorType.DEFAULT]: HandshakeException: Handshake error in client (OS Error:
CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:354))

解决办法:dio验证强制返回true:

  1. (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client){
  2. client.badCertificateCallback = (cert, host, port){
  3. return true;
  4. };
  5. };

2.Android 5.0之前的版本(API level < 21)使用Dalvik runtime来执行代码,默认限制每个APK只能使用一个classes.dex文件,而DEX规范又将单个DEX文件内引用的方法总数限制为65536个,第三方引入过多函数超限

D8: Cannot fit requested classes in a single dex file (# methods: 75464 > 65536)

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

解决办法:在android/app/build.gradle配置中添加参数:1.defaultConfig内添加  multiDexEnabled true  2.dependencies内添加  implementation 'com.android.support:multidex:1.0.3'

3.集成高德地图插件安卓运行报错闪退:

E/flutter (14718): [ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(43)] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amap/api/location/AMapLocationClient;

E/flutter (14718): at com.amap.flutter.location.AMapFlutterLocationPlugin.setApiKey(AMapFlutterLocationPlugin.java:115)

E/flutter (14718): at com.amap.flutter.location.AMapFlutterLocationPlugin.onMethodCall(AMapFlutterLocationPlugin.java:38)

E/flutter (14718): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230)

E/flutter (14718): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)

E/flutter (14718): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)

E/flutter (14718): at android.os.MessageQueue.nativePollOnce(Native Method)

E/flutter (14718): at android.os.MessageQueue.next(MessageQueue.java:336)

E/flutter (14718): at android.os.Looper.loop(Looper.java:174)

E/flutter (14718): at android.app.ActivityThread.main(ActivityThread.java:7356)

E/flutter (14718): at java.lang.reflect.Method.invoke(Native Method)

E/flutter (14718): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)

E/flutter (14718): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

解决办法:在app/build.gradle文件的dependencies配置中添加相关sdk依赖,参考下图:

4.集成Firebase推送模拟器运行报错:

E/FirebaseMessaging: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.
        at com.google.android.gms.tasks.Tasks.zza(com.google.android.gms:play-services-tasks@@18.0.1:5)
        at com.google.android.gms.tasks.Tasks.await(com.google.android.gms:play-services-tasks@@18.0.1:8)
        at com.google.firebase.messaging.GmsRpc.setDefaultAttributesToBundle(GmsRpc.java:260)
        at com.google.firebase.messaging.GmsRpc.startRpc(GmsRpc.java:222)
        at com.google.firebase.messaging.GmsRpc.getToken(GmsRpc.java:180)
        at com.google.firebase.messaging.FirebaseMessaging.lambda$blockingGetToken$10$FirebaseMessaging(FirebaseMessaging.java:610)
        at com.google.firebase.messaging.-

Lambda$FirebaseMessaging$1AYfBMlbEOJoTvXNSTEZqpK2SY.start(UnknownSource:6)atcom.google.firebase.messaging.RequestDeduplicator.getOrStartGetTokenRequest(RequestDeduplicator.java:67)atcom.google.firebase.messaging.FirebaseMessaging.blockingGetToken(FirebaseMessaging.java:606)atcom.google.firebase.messaging.SyncTask.maybeRefreshToken(SyncTask.java:121)atcom.google.firebase.messaging.SyncTask.run(SyncTask.java:91)atjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)atjava.util.concurrent.FutureTask.run(FutureTask.java:266)atjava.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)atcom.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:playservicesbasement@@18.0.0:2)atjava.lang.Thread.run(Thread.java:920)Causedby:com.google.firebase.installations.FirebaseInstallationsException:FirebaseInstallationsServiceisunavailable.Pleasetryagainlater.atcom.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(FirebaseInstallationServiceClient.java:208)atcom.google.firebase.installations.FirebaseInstallations.registerFidWithServer(FirebaseInstallations.java:530)atcom.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:385)atcom.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2$FirebaseInstallations(FirebaseInstallations.java:374)atcom.google.firebase.installations.
Lambda$FirebaseInstallations$VZq1h0TBcWNH8Y5yY86ujrFFyLo.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:920) 
Connected to process 8077 on device 'Nexus_6P_API_31 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 99001; state: ENABLED
I/ocessService0:: Background concurrent copying GC freed 464(100KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1997KB/3995KB, paused 641us,141us total 2.841s
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/cr_ChildProcessService: Creating new ChildProcessService pid=8077
解决办法:需要配置vpn

5. List赋值问题,有一个map list变量,我用一个新的list变量接收,然后在修改新的list数据的时候发现,旧的list变量的内容也变了:

  1. List list1 = [{'label': 'first name', 'value': 'Jack'}, {'label': 'last name', 'value': 'Gold'}];
  2. List list2 = List.from(list1);
  3. list2.last['valuee'] = 'Gould';
  4. print('list1: $list1 \n list2: $list2');
  5. // Console
  6. flutter: list1: [{label: first name, value: Jack}, {label: last name, value: Gold, valuee: Gould}]
  7. list2: [{label: first name, value: Jack}, {label: last name, value: Gold, valuee: Gould}]

解决方案:

通过for循环方式添加:List list2;    for (var item in list1) {list2.add(item);}

通过json decode+encode组合:List list2 = List.from(json.decode(json.encode(list1)));

6. iOS端 Pod Install报错:[!] Invalid `Podfile` file: undefined method `exists?' for File:Class.

原因是ruby3.2删除了对 exists 的支持导致该问题

解决方案:

1)升级Flutter SDK

2)打开flutter目录下的这个文件:/flutter/packages/flutter_tools/bin/podhelper.rb,搜索到这一行内容:return [] unless File.exists? file_path 将其中的 exists 改为 exist

后续问题会持续补充...

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/145315
推荐阅读
相关标签
  

闽ICP备14008679号