Skip to main content

Fixing a Package Name Mismatch Error In Flutter

Image of Daniel Reynolds
Daniel Reynolds
Software Engineer
Full stack engineer with nearly a decade of experience developing various applications and software

Last updated: July 2025

I ran into this error while deploying my new Flutter app "Decaf" to my phone:

adb: failed to install
/home/daniel/Personal/decaf/build/app/outputs/flutter-apk/app-debug.apk: Failure
[INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.rootcause.decaf
signatures do not match newer version; ignoring!]
Uninstalling old version...
Installing build/app/outputs/flutter-apk/app-debug.apk... 2,018ms
E/AndroidRuntime(17692): FATAL EXCEPTION: main
E/AndroidRuntime(17692): Process: com.rootcause.decaf, PID: 17692
E/AndroidRuntime(17692): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.rootcause.decaf/com.rootcause.decaf.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.rootcause.decaf.MainActivity"

The Solution

The solution was simple:

  • Ensure the package name set within MainActivity.kt (or maybe MainActivity.java in your case) matches the package name set in my build.grade
  • It seems mine defaulted to com.example.decaf, I just had to switch it over to com.rootcause.decaf (my actual package name)
note

You should ctrl-f and replace all the com.example that likely still exist throughout your repository! I had lots - see the git diff here

I hope this helps you out!