After changes in the export templates for Android Godot’s compilation with added godot-admob module can end with an error “D8: Program type already present:”.
For example:
> Task :transformDexArchiveWithExternalLibsDexMergerForDebug FAILED D8: Program type already present: android.support.v4.app.LoaderManager$LoaderCallbacks
or:
> Task :transformDexArchiveWithExternalLibsDexMergerForDebug FAILED D8: Program type already present: android.support.v4.widget.AutoScrollHelper$ClampedScroller
To fix this error, in the platform/android/build.gradle.template file, change the dependencies section (around line 25) by deleting the com.android.support:support-core-utils:28.0.0 entry:
From:
dependencies { implementation "com.android.support:support-core-utils:28.0.0" $GRADLE_DEPENDENCIES$ }
to:
dependencies { $GRADLE_DEPENDENCIES$ }
After this change, you must recompile the export for android:
scons -j 4 platform=android target=release cd platform/android/java ./gradlew build