Open
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Auth
Which platforms are affected?
Android
Description
When trying to perform oAuth on a device without a browser, the app crashes.
Reproducing the issue
- Run the provided code sample
- Uninstall or disable all browsers on your device (On Samsung, externally downloaded apps can only be uninstalled while only preinstalled apps can be disabled.)
- Press on
Hello, World!
- Observe app crashing
name: firebase_auth_bug
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0
environment:
sdk: ^3.7.2
dependencies:
flutter:
sdk: flutter
firebase_auth: ^5.5.2
firebase_core: ^3.13.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
flutter:
uses-material-design: true
{
"emulators": {
"auth": {
"host": "0.0.0.0"
}
}
}
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
late FirebaseAuth _auth;
const host = 'your host comes here';
const port = 9099;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final app = await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: 'non-empty',
appId: '1:1:android:1',
messagingSenderId: '',
projectId: 'demo-project',
),
);
_auth = FirebaseAuth.instanceFor(app: app);
_auth.useAuthEmulator(host, port);
runApp(const MainApp());
}
class MainApp extends StatefulWidget {
const MainApp({super.key});
@override
State<MainApp> createState() => _MainAppState();
}
class _MainAppState extends State<MainApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: TextButton(
child: Text('Hello World!'),
onPressed: () => _auth.signInWithProvider(GoogleAuthProvider()),
),
),
),
);
}
}
// android/app/build.gradle.kts
// ...
android {
defaultConfig {
// ...
minSdk = 23
// ...
}
}
Firebase Core version
3.13.0
Flutter Version
3.29.2
Relevant Log Output
Crash
/AndroidRuntime(21540): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://192.168.1.100:9099/... flg=0x50000000 (has extras) }
E/AndroidRuntime(21540): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2252)
E/AndroidRuntime(21540): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1878)
E/AndroidRuntime(21540): at android.app.Activity.startActivityForResult(Activity.java:5760)
E/AndroidRuntime(21540): at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:780)
E/AndroidRuntime(21540): at android.app.Activity.startActivityForResult(Activity.java:5718)
E/AndroidRuntime(21540): at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:761)
E/AndroidRuntime(21540): at android.app.Activity.startActivity(Activity.java:6216)
E/AndroidRuntime(21540): at android.app.Activity.startActivity(Activity.java:6183)
E/AndroidRuntime(21540): at com.google.firebase.auth.internal.GenericIdpActivity.zza(com.google.firebase:firebase-auth@@23.2.0:107)
E/AndroidRuntime(21540): at com.google.firebase.auth.internal.zzbg.onComplete(Unknown Source:4)
E/AndroidRuntime(21540): at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.1.0:1)
E/AndroidRuntime(21540): at android.os.Handler.handleCallback(Handler.java:958)
E/AndroidRuntime(21540): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(21540): at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime(21540): at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime(21540): at android.app.ActivityThread.main(ActivityThread.java:8919)
E/AndroidRuntime(21540): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21540): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
E/AndroidRuntime(21540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Additional context and comments
This is most likely a duplicate of an old stale issue #5768
In my case I stumbled on this issue because I disabled my browsers, however, according to this comment on StackOverflow it seems it is possible that a crash like this can happen even if there is a viable browser installed but the device doesn't have a default set.
This was only tested on Android, I don't know if other platforms are similarly affected.