Description
description of the Issue:
I added the mic_stream package (version 0.7.1) as a dependency in a basic Flutter demo app. The app crashes upon launch when tested on Android TV and Chromecast with Google TV. It's worth noting that I haven't added any code related to mic_stream in the main program (main.dart).
expected behavior:
The app should launch normally after adding the mic_stream dependency.
actual behavior:
The app crashes upon launch after adding the mic_stream dependency.
steps to reproduce:
- Create a new Flutter demo app.
- Add mic_stream (version 0.7.1) as a dependency in pubspec.yaml.
- Try launching the app on Android TV or Chromecast with Google TV.
my environment:
- Flutter Version: 3.13.6
- Dart Version: 3.1.3
- mic_stream Version: 0.7.1
- Target Android Version: 10 and above
- Physical Device: Chromecast with Google TV
- Emulator: Android TV (1080p) API 30
Sample main.dart Code from Demo App:
Below is the test code from my demo app's main.dart. Note that I haven't modified any code or added anything related to mic_stream in this demo app.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
Build Warning Logs:
When I build the APK for release using flutter build apk --release, I receive the following warnings related to mic_stream, which I suspect might be related to the issue:
PS C:\Users\User\Documents\VScode\flutter\chromcast_test_app> flutter build apk --release
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1336 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Note: C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\mic_stream-0.7.1\android\src\main\java\com\code\aaron\micstream\MicStreamPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\mic_stream-0.7.1\android\src\main\java\com\code\aaron\micstream\MicStreamPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Running Gradle task 'assembleRelease'... 58.9s
√ Built build\app\outputs\flutter-apk\app-release.apk (17.4MB).
I am unable to resolve these warnings with my current level of expertise, and I believe they could be contributing to the issue.
additional Information:
I have also tried another similar package, flutter_sound (version 8.1.4), and it works fine in the same environment.
special Note:
I have some projects that are already heavily dependent on mic_stream, so making changes would require a significant amount of time. Nevertheless, I'm still hopeful and writing here with a request for the author to please address this issue. Thank you!