hrach
hrach

Reputation: 2492

Program type already present: com.google.devtools.build.android.desugar.runtime.ThrowableExtension

When I enable building with Java 1.8 my build step transformDexArchiveWithExternalLibsDexMergerForDebug fails with this error:

Program type already present: com.google.devtools.build.android.desugar.runtime.ThrowableExtension$ConcurrentWeakIdentityHashMap$WeakKey
Message{kind=ERROR, text=Program type already present: com.google.devtools.build.android.desugar.runtime.ThrowableExtension$ConcurrentWeakIdentityHashMap$WeakKey, sources=[Unknown source file], tool name=Optional.of(D8)}

I'm quite desperate, I don't know how to debug this, what should I try/examine, etc. Of course I've tried clean build.

My setup:

classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'

compileSdkVersion 27
buildToolsVersion '27.0.3'

I'm also using Kotlin. The project is not small, I can't replicate it in clean project with same dependencies.

Upvotes: 2

Views: 941

Answers (2)

hrach
hrach

Reputation: 2492

Finally I solved this. This is a bug in google vr library (com.google.vr:sdk-videowidget) - we use an older version because the newer has higher minimal SDK Api requirement. The buggy one was 1.80.0, the fix is in 1.130.0.

I've discovered this by https://issuetracker.google.com/issues/69835550 - directly searching in Google's issue tracker, sadly it wasn't indexed in Google search. Lib issue: https://github.com/googlevr/gvr-android-sdk/issues/513

Upvotes: 1

Khaled Emara
Khaled Emara

Reputation: 96

This problems usually stems when the same dependency is implemented twice.

To look for conflicts run in adnroid studio's terminal the follwing

./gradlew app:dependencies

if you are on linux or

gradlew app:dependencies

if you are on widows

now look for conflicts:

if you see a library depended upon more than once look of "old-verion -> new-version" if you see it then gradle will solve this conflict for you, if you don't then that's the library you need to exclude from either libraries that depend on it using the line below.

The solution is to excluded the dependency that's implemented twice using the following line in your app gradle file

implementation ("<whatever>") {
    exclude module: '<conflict library>'
}

Upvotes: 0

Related Questions