Too many logs in flutter app when touch on screen - flutter

i have created new project in flutter and not added any single line in that default project still
it displays logs every time i touch on screen.
i think it is because of android 10 device.
anyone have any idea?
it gives below log every time i touch on screen
D/ColorViewRootUtil(29111): nav gesture mode swipeFromBottom ignore false downY 1325 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=425.0, y[0]=1325.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=11694678, downTime=11694678, deviceId=7, source=0x1002, displayId=0 } rotation 0

if you are using flutter sdk version v1.12.13+hotfix.8 you may face this issue because it is not stable.

Related

Fatal exception : Couldn't inflate contentViewsjava.lang.IllegalArgumentException: setShowActionsInCompactView: action 0 out of bounds (max -1)

i use test lab to find bugs on my apps and i have an but that i can't find the origins. I think it came from just_audio or audio_service.
This is the test issues :
android.app.RemoteServiceException: Bad notification(tag=null, id=1124) posted from package com.our_unseen_nature, crashing app(uid=10274, pid=22490): Couldn't inflate contentViewsjava.lang.IllegalArgumentException: setShowActionsInCompactView: action 0 out of bounds (max -1)
FATAL EXCEPTION: main
Process: com.our_unseen_nature, PID: 22490
android.app.RemoteServiceException: Bad notification(tag=null, id=1124) posted from package com.our_unseen_nature, crashing app(uid=10274, pid=22490): Couldn't inflate contentViewsjava.lang.IllegalArgumentException: setShowActionsInCompactView: action 0 out of bounds (max -1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7664)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Thank you everyone.
Thanks all, I've found the solution and It was really easy. The error occured because i didn't choose correctly the actions to show in Android's compact view based by those i've selected as my controls.
controls: [
MediaControl. skipToPrevious,
MediaControl.pause,
MediaControl.skipToNext,
],
// Which controls to show in Android's compact view
//from the lists of controls selected.
androidCompactActionIndices: const[0, 1, 2],

Flutter, simple method channel not working

I followed this https://docs.flutter.dev/development/platform-integration/platform-channels
D/InputTransport(12698): Input channel constructed: 'ClientS', fd=180
D/InputMethodManager(12698): prepareNavigationBarInfo() DecorView#9959d90[MainActivity]
D/InputMethodManager(12698): getNavigationBarColor() -16711423
V/InputMethodManager(12698): Starting input: tba=com.abc ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager(12698): startInputInner - Id : 0
I/SurfaceControl(12698): nativeRelease nativeObject s[-5476376642254367232]
I/SurfaceControl(12698): nativeRelease nativeObject e[-5476376642254367232]
I/SurfaceControl(12698): nativeRelease nativeObject s[-5476376642254367552]
I/SurfaceControl(12698): nativeRelease nativeObject e[-5476376642254367552]
continuously shows this.
The strange thing is that in Android project, clean project, rebuild, and turn off and restart Android studio sometimes works. (Only sometimes I can see the print("it works"); in MainActivity more specifically, inside of "configureFlutterEngine" function

VideoPlayer becomes black when dismissing a miniplayer in Flutter

I have a miniplayer where I have a video widget (I use better_player which depends on chewie and video_player). Everything works great unless I want to dismiss the miniplayer. The video is replaced with a black screen. I did some debugging and found out that for some reason the dispose() method is called on my video_widget twice (when I start dismissing and when I end dismissing my miniplayer). Below is a video that shows this behavior:
Could you help me with fixing this issue?
EDIT
I did some more debugging and found out that it is probably related to the video widget or better_player package. Also, I found out that when using chewie behavior is nearly the same but with chewie when I start dismissing video gets black for a millisecond and then initializes again and starts playing from the beginning. Here is the code of my `video widget class.
import 'dart:io';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter/services.dart';
import 'package:cook_it/screens/longs_page/providers/providers.dart';
import 'package:path_provider/path_provider.dart';
import 'package:better_player/better_player.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class LongsVideoItem extends StatefulWidget {
const LongsVideoItem({Key? key }) : super(key: key);
#override
_LongsVideoItemState createState() => _LongsVideoItemState();
}
class _LongsVideoItemState extends State<LongsVideoItem> {
void _toggleVideoControls(bool show){
if (show){
_betterPlayerController.setControlsEnabled(true);
}else{
_betterPlayerController.setControlsEnabled(false);
}
}
Future _saveAssetVideoToFile() async {
final content = await rootBundle.load("assets/videos/second.mp4");
final directory = await getApplicationDocumentsDirectory();
final file = File("${directory.path}/second.mp4");
_directory = "${directory.path}/second.mp4";
file.writeAsBytesSync(content.buffer.asUint8List());
}
BetterPlayerController _betterPlayerController = BetterPlayerController(const BetterPlayerConfiguration());
dynamic _directory;
#override
void initState() {
_saveAssetVideoToFile().then((value) {
final BetterPlayerDataSource betterPlayerDataSource = BetterPlayerDataSource(
BetterPlayerDataSourceType.file,
_directory.toString(),
);
_betterPlayerController = BetterPlayerController(
const BetterPlayerConfiguration(
deviceOrientationsAfterFullScreen: [DeviceOrientation.portraitUp],
aspectRatio: 16/9,
autoPlay: true,
controlsConfiguration: BetterPlayerControlsConfiguration(showControlsOnInitialize: false),
),
betterPlayerDataSource: betterPlayerDataSource,
);
});
super.initState();
}
#override
void dispose() {
super.dispose();
}
#override
Widget build(BuildContext context) {
return Consumer(
builder: (context, watch, _){
if (watch(videoShowControlsProvider).state == true){
_toggleVideoControls(true);
}else if (watch(videoShowControlsProvider).state == false){
_toggleVideoControls(false);
}
return BetterPlayer(controller: _betterPlayerController,);
}
);
}
}
here are the logs when I start dismissing
I/ExoPlayerImpl(16667): Release cd87770 [ExoPlayerLib/2.14.1] [HWCLT, CLT-L29, HUAWEI, 28] [goog.exo.core]
W/ACodec (16667): forcing OMX state to Idle when received shutdown in ExecutingState
3
E/BufferQueueProducer(16667): [SurfaceTexture-0-16667-145] cancelBuffer: BufferQueue has been abandoned
I/chatty (16667): uid=10234(com.example.cook_it) JNISurfaceTextu identical 10 lines
E/BufferQueueProducer(16667): [SurfaceTexture-0-16667-145] cancelBuffer: BufferQueue has been abandoned
D/SurfaceUtils(16667): disconnecting from surface 0x797bec7010, reason disconnectFromSurface
I/ExoPlayerImpl(16667): Init 8b84e21 [ExoPlayerLib/2.14.1] [HWCLT, CLT-L29, HUAWEI, 28]
V/AudioManager(16667): getStreamVolume treamType: 3
V/AudioManager(16667): isStreamMute streamType: 3
V/AudioManager(16667): getStreamMaxVolume treamType: 3
E/ (16667): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
I/OMXClient(16667): IOmx service obtained
I/ACodec (16667): In onAllocateComponent create compenent, codec name: OMX.hisi.video.decoder.avc
D/SurfaceUtils(16667): connecting to surface 0x797c027010, reason connectToSurface
I/MediaCodec(16667): [OMX.hisi.video.decoder.avc] setting surface generation to 17067154
D/SurfaceUtils(16667): disconnecting from surface 0x797c027010, reason connectToSurface(reconnect)
D/SurfaceUtils(16667): connecting to surface 0x797c027010, reason connectToSurface(reconnect)
E/ACodec (16667): [OMX.hisi.video.decoder.avc] setPortMode on output to DynamicANWBuffer failed w/ err -2147483648
I/HwExtendedCodec(16667): mime is [video/avc] at setVideoFormat
I/ACodec (16667): codec does not support config priority (err -22)
2
I/ACodec (16667): [OMX.hisi.video.decoder.avc] got color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) err=0(NO_ERROR)
I/ACodec (16667): [OMX.hisi.video.decoder.avc] using color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) and dataspace 0x104
I/ACodec (16667): onStart
D/SurfaceUtils(16667): disconnecting from surface 0x797c027010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(16667): connecting to surface 0x797c027010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(16667): set up nativeWindow 0x797c027010 for 1920x1080, color 0x30d, rotation 0, usage 0x20002900
6
W/MapperHal(16667): buffer descriptor with invalid usage bits 0x2000
2
I/ACodec (16667): [OMX.hisi.video.decoder.avc] got color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) err=0(NO_ERROR)
I/ACodec (16667): [OMX.hisi.video.decoder.avc] using color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) and dataspace 0x104
2
I/ACodec (16667): [OMX.hisi.video.decoder.avc] got color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) err=0(NO_ERROR)
I/ACodec (16667): [OMX.hisi.video.decoder.avc] using color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) and dataspace 0x104
D/SurfaceUtils(16667): disconnecting from surface 0x797c027010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(16667): connecting to surface 0x797c027010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(16667): set up nativeWindow 0x797c027010 for 1920x1088, color 0x30d, rotation 0, usage 0x20002900
W/ACodec (16667): [OMX.hisi.video.decoder.avc] setting nBufferCountActual to 19 failed: -2147483648
18
W/MapperHal(16667): buffer descriptor with invalid usage bits 0x2000
I/ACodec (16667): date space update : 0x104
I believe that for some reason this widget calls the dispose() method when I start dismissing. But why is that happening and how can I prevent that from happening?
I found the answer. The problem was in the miniplayer package. In case someone has the same problem comment here and I will explain how to fix it.

Emulator gives failure response: Trust anchor for certification path not found

I tried to search for this error a lot did not found any solution for it.
Details:
Made a request to API through retrofit, getting success response for the real devices but getting failure response if request is been made from android emulator.
public void loadPostsToDB() {
Call<List<Post>> call = mAPIServiceInterface.getAllPosts();
call.enqueue(new Callback<List<Post>>() {
#Override
public void onResponse(Call<List<Post>> call, Response<List<Post>> response) {
List<Post> posts = response.body();
new InsertPostAsyncTask(mDaoInterface,posts).execute();
}
#Override
public void onFailure(Call<List<Post>> call, Throwable t) {
Log.e("Failure Reason : "," "+t.toString());
}
});
}
In above code gives response, I checked through debugging, as per it, point hits on success when ran from real device but failure function debug point got hit if ran from emulator.
Below is the log which got printed.
2020-12-01 20:57:23.647 6863-6879/reference.module.retrofit D/OkHttp: --> GET https://jsonplaceholder.typicode.com/posts
2020-12-01 20:57:23.647 6863-6879/reference.module.retrofit D/OkHttp: --> END GET
2020-12-01 20:57:23.828 6863-6882/reference.module.retrofit I/OpenGLRenderer: Initialized EGL, version 1.4
2020-12-01 20:57:23.828 6863-6882/reference.module.retrofit D/OpenGLRenderer: Swap behavior 1
2020-12-01 20:57:23.829 6863-6882/reference.module.retrofit W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2020-12-01 20:57:23.829 6863-6882/reference.module.retrofit D/OpenGLRenderer: Swap behavior 0
2020-12-01 20:57:23.849 6863-6882/reference.module.retrofit D/EGL_emulation: eglCreateContext: 0x9ca04240: maj 2 min 0 rcv 2
2020-12-01 20:57:23.924 6863-6882/reference.module.retrofit D/EGL_emulation: eglMakeCurrent: 0x9ca04240: ver 2 0 (tinfo 0x9ca037d0)
2020-12-01 20:57:24.135 6863-6882/reference.module.retrofit D/EGL_emulation: eglMakeCurrent: 0x9ca04240: ver 2 0 (tinfo 0x9ca037d0)
2020-12-01 20:57:24.278 6863-6879/reference.module.retrofit D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
2020-12-01 20:57:24.279 6863-6863/reference.module.retrofit E/FailureĀ ReasonĀ :: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
Any suggestion? what might be causing this behaviour?
The issue got solved,
It was required change from server side for certificates.

Flutter: Camera disconnect exception when other camera apps are opened

I'm currently using the flutter camera package to record and save videos, but I've noticed that the camera preview runs into an exception when the device's camera is opened on another app or when face unlock is used on the lock screen.
I've tried using didChangeAppLifecycleState to possibly fetch or reinitialize the camera, but there's no success yet.
await model.fetchCameras();
if (model.cameras.isNotEmpty) {
await model.onNewCameraSelected(model.cameras[model.cameraIndex], true);
}
}
This issue is currently opened here and here, but haven't been resolved.
I get this exception when the device's camera is opened in another app. I tried disposing the camera and reinitializing it in the sample code above, but it doesn't work.
E/CameraCaptureSession(31468): android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): cancelRequest:458: Camera device no longer alive
E/CameraCaptureSession(31468): at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:814)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:95)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1134)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:737)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:242)
E/CameraCaptureSession(31468): at android.os.Handler.handleCallback(Handler.java:873)
E/CameraCaptureSession(31468): at android.os.Handler.dispatchMessage(Handler.java:99)
E/CameraCaptureSession(31468): at android.os.Looper.loop(Looper.java:214)
E/CameraCaptureSession(31468): at android.app.ActivityThread.main(ActivityThread.java:6981)
E/CameraCaptureSession(31468): at java.lang.reflect.Method.invoke(Native Method)
E/CameraCaptureSession(31468): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/CameraCaptureSession(31468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
E/CameraCaptureSession(31468): Caused by: android.os.ServiceSpecificException: cancelRequest:458: Camera device no longer alive (code 4)
E/CameraCaptureSession(31468): at android.os.Parcel.createException(Parcel.java:1980)
E/CameraCaptureSession(31468): at android.os.Parcel.readException(Parcel.java:1934)
E/CameraCaptureSession(31468): at android.os.Parcel.readException(Parcel.java:1884)
E/CameraCaptureSession(31468): at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:402)
E/CameraCaptureSession(31468): at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRe
Any Ideas, on how to force the camera package to reinitialize?
On resume re initialise Camera
#override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
_controller != null
? _initializeControllerFuture = _controller.initialize()
: null; //on pause camera is disposed, so we need to call again "issue is only for android"
}
}
checkout https://medium.com/#navinkumar0118/take-a-picture-using-flutter-camera-a9c11d282632