android: Gradle build error due to Android support lib 27.1.0 usage / Program type already present
CLI version: 4.2.1 Android runtime version: 4.2.0 minSdkVersion: 21 targetSdkVersion: 26
Not sure if this is a bug, but after upgrading to {N} 4.2 our release build for Android fails during Gradle’s :app:transformDexArchiveWithExternalLibsDexMergerForRelease task.
Error:
D8: Program type already present: android.support.design.widget.CoordinatorLayout$Behavior
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForRelease’.
It turned out that the Android support lib version used in the generated platforms/android/app/build.gradle is causing this.
Workaround was to add this to the App_Resources/Android/app.gradle file
ext {
supportVersion = "27.1.0"
}
then compilation works fine.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 18 (7 by maintainers)
Just tried it and it worked on Android 4.3. Seems good!
@edusperoni I’ve found what’s causing the error. We are using getDeclaredMethods of the TextInputLayout class to get the list of available methods when searching the corresponding Java method of a JavaScript method call. So this call is causing the app to crash. You can reproduce the same behaviour in a native app by calling the following code:
We’ve found a fix for this and I hope it will be part of our next release. Thanks for helping me finding the root cause!