question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

D8: Program type already present: com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil

See original GitHub issue

Current behavior

gradlew buildRelease don’t build my app because of an issue with async-storage.

Expected behavior

It should build without errors.

Repro steps

I added this library on my project.

Environment

  • Async Storage version: 1.8.1
  • React-Native version: 0.61.5
  • Platform tested: Android
  • Logs/Error that are relevant: `> Task :app:transformClassesAndResourcesWithR8ForRelease FAILED R8 is the new Android code shrinker. If you experience any issues, please file a bug at https://issuetracker.google.com, using ‘Shrinker (R8)’ as component name. You can disable R8 by updating gradle.properties with ‘android.enableR8=false’. Current version is: 1.4.94 (build 390954928f0db9c3b888a367f7f128ce3bbfb160 from go/r8bot (luci-r8-ci-archive-0-5g74)).

D8: Program type already present: com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:transformClassesAndResourcesWithR8ForRelease’.

com.android.tools.r8.CompilationFailedException: Compilation failed to complete

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

74reactions
AlexisTonneaucommented, Dec 1, 2020

I ran into the similar issue, tried all steps, didn’t work. I checked my package.json file and I figured out that i had 2 versions of react-native-async-storage, the community one and the oldest one. Just delete the old one, re-install with yarn on NPM, and it should work.

7reactions
mattveraldicommented, Mar 31, 2020

Is AsyncStorage linked manually? Have you tried to clean and rebuild? Or try to disable R8 to see if it can build without it?

@Krizzu thank you for your reply. I solved it. At the time I installed this package at first I linked it manually, then, I unlinked it via react-native unlink @react-native-community/async-storage. But I found out there were still some references in settings.gradle and build.gradle, I removed them and now it works fine!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-native android "Program type already present
This is because you have linked library by yourself just run following command: react-native unlink @react-native-community/async-storage.
Read more >
[Solved]-React-native android "Program type already present
Coding example for the question React-native android "Program type already present: com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil"-React ...
Read more >
Developers - Cannot take build for android - Task :app ...
... FAILED - Program type already present: com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil.
Read more >
解决RN开发报错Program type already present - 程序员大本营
解决RN开发报错Program type already present: com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil,程序员大本营,技术文章内容聚合第一站。
Read more >
app:assembleRelease failed, conflicting react native netinfo ...
Type com.reactnativecommunity.netinfo. ... D8.run(:11) at com.android.builder.dexing.D8DexArchiveMerger.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found