Missing classes when building signed AAB

I followed the steps to upgrade my project to Capacitor 8.
Everything works fine for testing and building on my local device or simulator, but when i try to generate a signed bundle i get the following errors :

Task :capacitor-preferences:minifyReleaseWithR8 FAILED
Supplied proguard configuration does not exist: /node_modules/@capacitor/preferences/android/proguard-rules.pro
AGPBI: {“kind”:“error”,“text”:“Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in node_modules/@capacitor/preferences/android/build/outputs/mapping/release/missing_rules.txt.”,“sources”:[{}]}
AGPBI: {“kind”:“error”,“text”:“Missing class com.getcapacitor.JSArray (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.keys(com.getcapacitor.PluginCall) and 1 other context)\nMissing class com.getcapacitor.JSObject (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.get(com.getcapacitor.PluginCall) and 2 other contexts)\nMissing class com.getcapacitor.Plugin (referenced from: com.capacitorjs.plugins.preferences.PreferencesPlugin)\nMissing class com.getcapacitor.PluginCall (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.clear(com.getcapacitor.PluginCall) and 7 other contexts)\nMissing class com.getcapacitor.PluginMethod (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.clear(com.getcapacitor.PluginCall) and 7 other contexts)\nMissing class com.getcapacitor.annotation.CapacitorPlugin (referenced from: com.capacitorjs.plugins.preferences.PreferencesPlugin)”,“sources”:[{}],“tool”:“R8”}

Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in node_modules/@capacitor/preferences/android/build/outputs/mapping/release/missing_rules.txt.


Missing class com.getcapacitor.JSArray (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.keys(com.getcapacitor.PluginCall) and 1 other context)
Missing class com.getcapacitor.JSObject (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.get(com.getcapacitor.PluginCall) and 2 other contexts)
Missing class com.getcapacitor.Plugin (referenced from: com.capacitorjs.plugins.preferences.PreferencesPlugin)
Missing class com.getcapacitor.PluginCall (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.clear(com.getcapacitor.PluginCall) and 7 other contexts)
Missing class com.getcapacitor.PluginMethod (referenced from: void com.capacitorjs.plugins.preferences.PreferencesPlugin.clear(com.getcapacitor.PluginCall) and 7 other contexts)
Missing class com.getcapacitor.annotation.CapacitorPlugin (referenced from: com.capacitorjs.plugins.preferences.PreferencesPlugin)


Thanks a lot for any idea

1 Like

Hi, i had the same error and for days couldn’t fix it. What i did was run command npm outdated.
It listed this:

image

Then i updated those packages to the ‘Wanted’version.
Like below:

image

After that i did npm audit fix
When the packages were updated safely i did npm run build and npx cap sync
Then miraculously the release signed build succeeded.

I hope this helps. I struggled for days…

This happens because some Capacitor packages are out of sync after upgrading to Capacitor 8. Update all outdated Capacitor dependencies to the wanted versions, then run npm audit fix, rebuild the project, and run npx cap sync. Once all Capacitor packages match, the missing R8 classes error goes away and the signed AAB builds correctly.