From e8f83057a6e9315b7a26a6b74b145388095cbf20 Mon Sep 17 00:00:00 2001 From: Adam Stinziani Date: Wed, 13 Mar 2024 04:53:53 -0400 Subject: [PATCH] Fix type conversion issue in VideoViewController Gradle forward compatibility. Tested on a Flutter project using Gradle version 8.3, along with the current Agora SDK Gradle version --- .../io/agora/agora_rtc_ng/VideoViewController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/io/agora/agora_rtc_ng/VideoViewController.java b/android/src/main/java/io/agora/agora_rtc_ng/VideoViewController.java index 968a263a8..9b2d8d123 100644 --- a/android/src/main/java/io/agora/agora_rtc_ng/VideoViewController.java +++ b/android/src/main/java/io/agora/agora_rtc_ng/VideoViewController.java @@ -186,8 +186,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result @SuppressWarnings("ConstantConditions") final long irisRtcRenderingHandle = getLong(args.get("irisRtcRenderingHandle")); @SuppressWarnings("ConstantConditions") final long uid = getLong(args.get("uid")); final String channelId = (String) args.get("channelId"); - final int videoSourceType = (int) args.get("videoSourceType"); - final int videoViewSetupMode = (int) args.get("videoViewSetupMode"); + final int videoSourceType = getInt(args.get("videoSourceType")); + final int videoViewSetupMode = getInt(args.get("videoViewSetupMode")); final long textureId = createTextureRender( irisRtcRenderingHandle, @@ -229,7 +229,12 @@ private void disposeAllRenderers() { private long getLong(Object value) { return Long.parseLong(value.toString()); } - + /** + * Handle incompatible type error in Flutter projects using more recent versions of Gradle + */ + private int getInt(Object value) { + return Integer.parseInt(value.toString()); + } public void dispose() { methodChannel.setMethodCallHandler(null); }