问题具体描述:
AS断点发现值已经传到了后端,后端断点(Spring)发现key "B"
的值为空字符串""
,flutter传参的数据结构为:
{"A":"111",
"B":["222","333"]
}
后端取值发现 "B"
的值取不到,报错显示的是"B[]"
的参数问题 。
解决方式:
方式1: 后端,经试验后端取值key 从"B"
改为"B[]"
,正常运行。
方式2:flutter 端,其他解决方式参考:https://xingdi.me/archives/50.html
控制台错误如下:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:releaseRuntimeClasspath'.
> Conflict(s) found for the following module(s):
- com.squareup.okhttp3:okhttp between versions 3.10.0 and 3.3.0
- com.squareup.okio:okio between versions 1.14.0 and 1.13.0
Run with:
--scan or
:app:dependencyInsight --configuration releaseRuntimeClasspath --dependency com.squareup.okhttp3:okhttp
to get more insight on how to solve the conflict.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 2.2s
Gradle task assembleRelease failed with exit code 1
解决方式:强制在android/app/build.gradle
中指定依赖
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp3:okhttp:3.10.0'
force 'com.squareup.okio:okio:1.14.0'
}
}
1.file_preview(在线文件预览)
(1)打开时出现如下问题:
E/MethodChannel#com.zzaning.file_preview(23244): Failed to handle method call
E/MethodChannel#com.zzaning.file_preview(23244): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.demo.myapp/zzaning.com.filepreview.FileDisplayActivity}; have you declared this activity in your AndroidManifest.xml?
E/MethodChannel#com.zzaning.file_preview(23244): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1944)
E/MethodChannel#com.zzaning.file_preview(23244): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1622)
E/MethodChannel#com.zzaning.file_preview(23244): at android.app.ContextImpl.startActivity(ContextImpl.java:882)
E/MethodChannel#com.zzaning.file_preview(23244): at android.app.ContextImpl.startActivity(ContextImpl.java:859)
E/MethodChannel#com.zzaning.file_preview(23244): at android.content.ContextWrapper.startActivity(ContextWrapper.java:372)
E/MethodChannel#com.zzaning.file_preview(23244): at zzaning.com.filepreview.FileDisplayActivity.show(FileDisplayActivity.java:91)
E/MethodChannel#com.zzaning.file_preview(23244): at zzaning.com.filepreview.FilePreviewPlugin.onMethodCall(FilePreviewPlugin.java:56)
E/MethodChannel#com.zzaning.file_preview(23244): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
E/MethodChannel#com.zzaning.file_preview(23244): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.zzaning.file_preview(23244): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
E/MethodChannel#com.zzaning.file_preview(23244): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.zzaning.file_preview(23244): at android.os.MessageQueue.next(MessageQueue.java:325)
E/MethodChannel#com.zzaning.file_preview(23244): at android.os.Looper.loop(Looper.java:149)
E/MethodChannel#com.zzaning.file_preview(23244): at android.app.ActivityThread.main(ActivityThread.java:6840)
E/MethodChannel#com.zzaning.file_preview(23244): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.zzaning.file_preview(23244): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/MethodChannel#com.zzaning.file_preview(23244): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
E/flutter (23244): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Unable to find explicit activity class {com.demo.myapp/zzaning.com.filepreview.FileDisplayActivity}; have you declared this activity in your AndroidManifest.xml?, null)
E/flutter (23244): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (23244): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (23244):
E/flutter (23244): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (23244): #3 FilePreview.openFile (package:file_preview/file_preview.dart:11:42)
E/flutter (23244): #4 _FilePickerUtilState._typeWidget. (package:plascloud_flutter/util/file_picker_util.dart:360:25)
E/flutter (23244): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
E/flutter (23244): #6 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:862:36)
E/flutter (23244): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (23244): #8 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:504:11)
E/flutter (23244): #9 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:282:5)
E/flutter (23244): #10 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:217:7)
E/flutter (23244): #11 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:475:9)
E/flutter (23244): #12 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
E/flutter (23244): #13 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:122:9)
E/flutter (23244): #14 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
E/flutter (23244): #15 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
E/flutter (23244): #16 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
E/flutter (23244): #17 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (23244): #18 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (23244): #19 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (23244): #20 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (23244): #21 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (23244): #22 _rootRunUnary (dart:async/zone.dart:1196:13)
E/flutter (23244): #23 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (23244): #24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (23244): #25 _invoke1 (dart:ui/hooks.dart:275:10)
E/flutter (23244): #26 _dispatchPointerDataPacket (dart:ui/hooks.dart:184:5)
解决方法:在flutter的AndroidManifest.xml中加入
(2)加载时出现如下:
I/ViewRootImpl(24083): WindowInputEventReceiver onInputEvent!! KeyCode is 4, action is 0
I/ViewRootImpl(24083): ViewPostImeInputStage processKeyEvent back key, this android.view.ViewRootImpl$ViewPostImeInputStage@329ac9b
I/ViewRootImpl(24083): WindowInputEventReceiver onInputEvent!! KeyCode is 4, action is 1
I/ViewRootImpl(24083): ViewPostImeInputStage processKeyEvent back key, this android.view.ViewRootImpl$ViewPostImeInputStage@329ac9b
I/MobclickAgent(24083): Extend current session: C225DA6B4A617DBBBE388BA9C3B48CA9
W/System.err(24083): java.nio.channels.ClosedChannelException
W/System.err(24083): at sun.nio.ch.FileLockImpl.release(FileLockImpl.java:58)
W/System.err(24083): at com.tencent.common.plugin.QBPluginServiceImpl.deletePidFile(TbsJavaCore:3464)
W/System.err(24083): at com.tencent.common.plugin.QBPluginServiceImpl.stopDownloadPlugin(TbsJavaCore:1466)
W/System.err(24083): at com.tencent.common.plugin.QBPluginProxy.stopDownloadPlugin(TbsJavaCore:424)
W/System.err(24083): at com.tencent.common.plugin.QBPluginSystem$2.handleMessage(TbsJavaCore:1858)
W/System.err(24083): at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err(24083): at android.os.Looper.loop(Looper.java:192)
W/System.err(24083): at android.os.HandlerThread.run(HandlerThread.java:65)
I/qtaguid (24083): Untagging socket 116 failed errno=-22
E/QB_DOWN::DownloadWorker(24083): ERR [run]
E/QB_DOWN::DownloadWorker(24083): java.net.SocketException: Socket closed
E/QB_DOWN::DownloadWorker(24083): at java.net.SocketInputStream.read(SocketInputStream.java:203)
E/QB_DOWN::DownloadWorker(24083): at java.net.SocketInputStream.read(SocketInputStream.java:139)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.okio.Okio$2.read(Okio.java:136)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:756)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:628)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:471)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaders(HttpURLConnectionImpl.java:163)
E/QB_DOWN::DownloadWorker(24083): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaderFields(HttpURLConnectionImpl.java:223)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.common.http.HttpRequesterBase.parseResponseHeaders(TbsJavaCore:728)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.common.http.HttpRequesterBase.a(TbsJavaCore:198)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.common.http.HttpRequesterBase.a(TbsJavaCore:187)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.common.http.HttpRequesterBase.execute(TbsJavaCore:81)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.mtt.browser.download.engine.network.DownloadConnection.execute(TbsJavaCore:173)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.mtt.browser.download.engine.core.DownloadWorker.run(TbsJavaCore:254)
E/QB_DOWN::DownloadWorker(24083): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
E/QB_DOWN::DownloadWorker(24083): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
E/QB_DOWN::DownloadWorker(24083): at com.tencent.mtt.browser.download.engine.core.DownloadThreadPolicy$2.run(TbsJavaCore:51)
I/MobclickAgent(24083): Extend current session: C225DA6B4A617DBBBE388BA9C3B48CA9
I/qtaguid (24083): Untagging socket 116 failed errno=-22
W/System.err(24083): android.content.pm.PackageManager$NameNotFoundException: com.tencent.mtt
W/System.err(24083): at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:193)
W/System.err(24083): at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:149)
W/System.err(24083): at com.tencent.common.utils.MttLoader.getBrowserInfo(TbsJavaCore:442)
W/System.err(24083): at com.tencent.mtt.external.reader.MttFileReaderWrapper.(TbsJavaCore:151)
W/System.err(24083): at com.tencent.tbs.tbsshell.partner.reader.c.a(TbsJavaCore:418)
W/System.err(24083): at com.tencent.tbs.tbsshell.partner.reader.c.a(TbsJavaCore:129)
W/System.err(24083): at com.tencent.tbs.reader.TbsReader.openFile(TbsJavaCore:59)
W/System.err(24083): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(24083): at com.tencent.smtt.export.external.DexLoader.invokeMethod(Unknown Source:14)
W/System.err(24083): at com.tencent.smtt.sdk.ReaderWizard.openFile(Unknown Source:44)
W/System.err(24083): at com.tencent.smtt.sdk.TbsReaderView.openFile(Unknown Source:61)
W/System.err(24083): at zzaning.com.filepreview.SuperFileView2.displayFile(SuperFileView2.java:80)
W/System.err(24083): at zzaning.com.filepreview.FileDisplayActivity$2.onResponse(FileDisplayActivity.java:155)
W/System.err(24083): at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
W/System.err(24083): at android.os.Handler.handleCallback(Handler.java:790)
W/System.err(24083): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(24083): at android.os.Looper.loop(Looper.java:192)
W/System.err(24083): at android.app.ActivityThread.main(ActivityThread.java:6840)
W/System.err(24083): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(24083): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err(24083): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
E/superFileLog(24083): ****************************************************5045
W/down-pool-1(24083): type=1400 audit(0.0:35625982): avc: denied { read } for name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=15543 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0
E/libc (24083): Access denied finding property "net.dns1"
解决方式:参考https://blog.csdn.net/tung214/article/details/72734086
2.使用插件 flutter_image_compress: ^0.7.0
打包报错:
``
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':flutter_image_compress'.
> Could not resolve all artifacts for configuration ':flutter_image_compress:classpath'.
> Could not resolve org.apache.httpcomponents:httpcore:4.4.6.
Required by:
project :flutter_image_compress > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > de.undercouch:gradle-download-task:3.4.3 > org.apache.httpcomponents:httpclient:4.5.3
> Could not resolve org.apache.httpcomponents:httpcore:4.4.6.
> Could not get resource 'https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.pom'.
> Connect to dl.google.com:443 [dl.google.com/203.208.40.33] failed: Read timed out
> Could not get unknown property 'android' for project ':flutter_image_compress' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 44s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 105.2s
Gradle task assembleRelease failed with exit code 1
``
解决方式:
(1) classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72”(见作者的该项目GitHub)
(2)参看下面的步骤:
1、修改版本,修改android{}
compileSdkVersion 22(或者更高)
2、在android{}中添加
useLibrary 'org.apache.http.legacy'
3、在dependencies{}中添加
compile 'org.apache.httpcomponents:httpcore:4.4.2'
————————————————
原文链接:https://blog.csdn.net/danwuxie/article/details/84500818
fatal: unable to access 'https://chromium.googlesource.com/webm/libwebp/'