This error occurs when using Firebase Authentication's ActionCodeSettings with Android-specific options like installIfNotAvailable or minimumVersion without providing the required androidPackageName parameter.
The `auth/missing-android-pkg-name` error is thrown by Firebase Authentication when you attempt to configure ActionCodeSettings with Android-specific parameters but fail to provide the Android package name. This typically happens when sending email verification links, password reset emails, or email sign-in links that need to be handled by your Android app. Firebase's ActionCodeSettings allows you to customize how email action links behave across different platforms. When you specify Android-specific settings like `installIfNotAvailable` (to install the app from Google Play if not present) or `minimumVersion` (to enforce a minimum app version), Firebase requires the `androidPackageName` to know which app should handle the link. Without this package name, Firebase cannot route the user to the correct Android application. This validation ensures that email links are properly configured before being sent to users, preventing broken authentication flows where users click a link but the system doesn't know which app to open.
When using Android-specific settings in ActionCodeSettings, always provide the package name as the first parameter.
For Android/Java:
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
.setUrl("https://www.example.com/finishSignUp")
.setHandleCodeInApp(true)
.setAndroidPackageName(
"com.example.android", // Your Android package name
true, // installIfNotAvailable
"12" // minimumVersion (optional)
)
.build();
FirebaseAuth.getInstance()
.sendSignInLinkToEmail(email, actionCodeSettings);For Web/JavaScript:
const actionCodeSettings = {
url: 'https://www.example.com/finishSignUp',
handleCodeInApp: true,
android: {
packageName: 'com.example.android',
installApp: true,
minimumVersion: '12'
}
};
await auth.sendSignInLinkToEmail(email, actionCodeSettings);For Flutter:
final actionCodeSettings = ActionCodeSettings(
url: 'https://www.example.com/finishSignUp',
handleCodeInApp: true,
androidPackageName: 'com.example.android',
androidInstallApp: true,
androidMinimumVersion: '12',
);
await FirebaseAuth.instance.sendSignInLinkToEmail(
email: email,
actionCodeSettings: actionCodeSettings,
);Ensure the package name you provide matches exactly what's configured in your Android app and Firebase console.
Check your Android app's package name:
1. Open android/app/build.gradle
2. Find the applicationId in the defaultConfig block:
android {
defaultConfig {
applicationId "com.example.android" // This is your package name
// ...
}
}Verify in Firebase Console:
1. Go to Firebase Console → Project Settings
2. Scroll to "Your apps" section
3. Select your Android app
4. Confirm the package name matches exactly (case-sensitive)
If the package names don't match, either update your ActionCodeSettings to use the correct package name, or reconfigure your Firebase project with the correct package name.
If you don't actually need Android-specific behavior (like app installation or version enforcement), simply omit those parameters:
Minimal configuration (no Android-specific settings):
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
.setUrl("https://www.example.com/finishSignUp")
.setHandleCodeInApp(true)
.build();This configuration will still work on Android devices but won't attempt to install the app or enforce version requirements. The email link will simply open in the user's browser or app if already installed.
Only include androidPackageName and related settings if you specifically need:
- Automatic app installation from Google Play
- Minimum version enforcement
- Direct deep linking to your Android app
Create a fully configured ActionCodeSettings object with all required fields for your use case:
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
// Required: URL where the link should redirect
.setUrl("https://www.example.com/finishSignUp?email=" + email)
// Required for email link authentication
.setHandleCodeInApp(true)
// Android configuration (all three parameters)
.setAndroidPackageName(
"com.example.android", // Package name (REQUIRED if using Android settings)
true, // Install if not available
"12" // Minimum version
)
// iOS configuration (optional)
.setIOSBundleId("com.example.ios")
// Optional: Additional state/context
.setDynamicLinkDomain("example.page.link")
.build();
try {
FirebaseAuth.getInstance()
.sendSignInLinkToEmail(email, actionCodeSettings)
.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.d("Auth", "Email link sent successfully");
}
});
} catch (Exception e) {
Log.e("Auth", "Failed to send email link: " + e.getMessage());
}Ensure you've added the necessary Firebase configuration files (google-services.json) to your Android project.
Dynamic Links Deprecation:
Firebase Dynamic Links, which were previously used for email link authentication, are being deprecated on August 25, 2025. If you're building new features with email links, consider migrating to the Firebase Hosting-based solution for handling authentication links. The androidPackageName requirement remains the same in both approaches.
Package Name Security:
The package name serves as a security identifier in Firebase. Each combination of package name and SHA-1 certificate fingerprint must be unique across all Firebase and Google Cloud projects. This prevents unauthorized apps from intercepting authentication links meant for your app.
Testing Email Links:
When testing email link authentication in development, you can use Android emulators or physical devices. The package name must match your debug or release build configuration. For debug builds, you may need to add the debug SHA-1 fingerprint to your Firebase project settings.
Cross-Platform Considerations:
If your app supports both Android and iOS, configure both platforms in ActionCodeSettings. The system will automatically detect the user's platform and route them appropriately:
.setAndroidPackageName("com.example.android", true, "12")
.setIOSBundleId("com.example.ios")React Native & Flutter:
These frameworks abstract the native configuration but still require the package name to be specified. Ensure your platform-specific configuration files (android/app/build.gradle for Android) have the correct applicationId that matches what you provide to ActionCodeSettings.
messaging/UNSPECIFIED_ERROR: No additional information available
How to fix "messaging/UNSPECIFIED_ERROR: No additional information available" in Firebase Cloud Messaging
App Check: reCAPTCHA Score Too Low
App Check reCAPTCHA Score Too Low
storage/invalid-url: Invalid URL format for Cloud Storage reference
How to fix invalid URL format in Firebase Cloud Storage
auth/missing-uid: User ID identifier required
How to fix "auth/missing-uid: User ID identifier required" in Firebase
auth/invalid-argument: Invalid parameter passed to method
How to fix "auth/invalid-argument: Invalid parameter passed to method" in Firebase