Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minifyEnabled true ERROR : Compilation failed to complete, origin: /Users/mesutaltas/.gradle/caches/transforms-3/a334453207e8f257bd8e5065fd1e9287/transformed/jetified-kotlin-reflect-1.8.10.jar:kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class #36476

Closed
recepaltas opened this issue Mar 14, 2023 · 15 comments
Labels
API: Transforms Needs: Attention Issues where the author has responded to feedback. Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library

Comments

@recepaltas
Copy link

recepaltas commented Mar 14, 2023

Description

When I set minifyEnabled true and start./gradlew assembleRelease build failed . I tested a fresh project and existing project. Can you help me for fix.
build.gradle (android/app/build.gradle)

buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

ERROR

ERROR:/Users/mesutaltas/.gradle/caches/transforms-3/a334453207e8f257bd8e5065fd1e9287/transformed/jetified-kotlin-reflect-1.8.10.jar: R8: Type kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsResourceLoader is defined multiple times: /Users/mesutaltas/.gradle/caches/transforms-3/a334453207e8f257bd8e5065fd1e9287/transformed/jetified-kotlin-reflect-1.8.10.jar:kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class, /Users/mesutaltas/.gradle/caches/transforms-3/a334453207e8f257bd8e5065fd1e9287/transformed/jetified-kotlin-reflect-1.8.10.jar:META-INF/versions/9/kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

React Native Version

0.71.4

Output of npx react-native info

System:
OS: macOS 13.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 157.51 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - /usr/local/bin/node
Yarn: Not Found
npm: 9.5.0 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 28, 29, 30, 31, 33
Build Tools: 28.0.3, 30.0.2, 30.0.3, 31.0.0, 33.0.0
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6858069
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.3 => 0.71.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  1. minifyEnabled true
  2. ./gradlew assembleRelease

Snack, code example, screenshot, or link to a repository

no

@github-actions
Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@recepaltas
Copy link
Author

I upgraded version 0.71.4 and still get error

@recepaltas
Copy link
Author

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

I upgraded version 0.71.4 and still get error

@cortinico
Copy link
Contributor

Can you try to cd android && ./gradlew --stop and try again?

@recepaltas
Copy link
Author

Yes I tried many times . I created fresh app with npx create-react-native-app and enabled minifyEnabled = true . But didnt work. Same error did it. What is the problem i cant figure it out.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Mar 16, 2023
@cortinico
Copy link
Contributor

Can you try to rm ~/.gradle and build again?

@cortinico cortinico added Newer Patch Available Needs: Author Feedback and removed Needs: Attention Issues where the author has responded to feedback. Newer Patch Available labels Mar 17, 2023
@facebook facebook deleted a comment from github-actions bot Mar 17, 2023
@recepaltas
Copy link
Author

yes I tried many times. Same.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Mar 21, 2023
@recepaltas
Copy link
Author

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
The Kotlin plugin was loaded in the following projects: ':expo', ':expo-modules-core'

I think the main reason is this? How can I solve this?

@recepaltas
Copy link
Author

ERROR:/Users/mesutaltas/.gradle/caches/transforms-3/00bc5269aa3db6545a8650b66aef371e/transformed/jetified-kotlin-reflect-1.6.21.jar: R8: Type kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsResourceLoader is defined multiple times: /Users/mesutaltas/.gradle/caches/transforms-3/00bc5269aa3db6545a8650b66aef371e/transformed/jetified-kotlin-reflect-1.6.21.jar:kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class, /Users/mesutaltas/.gradle/caches/transforms-3/00bc5269aa3db6545a8650b66aef371e/transformed/jetified-kotlin-reflect-1.6.21.jar:META-INF/versions/9/kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class

@recepaltas
Copy link
Author

recepaltas commented Mar 22, 2023

When I create the project

  • npx react-native@latest init Project --> minifyEnabled = true. -> No Problem
  • npx create-react-native-app -> Blank Temlate -> minifyEnabled = true -> Error Same
    It has same error also npx react-native@latest init Project -> yarn add expo-core-modules -> Same Error

The Problem is multiple kotlin. There are different packages with kotlin plugins like expo,expo-module,react-native-screens,react-native-gestlure-handler etc.. How can I solve this?

@huan415201
Copy link

Does anyone solve this? I've tried gradlew clean, gradlew --stop, add to android/build.gradle org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m, but nothing fix this bug.

@cortinico
Copy link
Contributor

The Problem is multiple kotlin. There are different packages with kotlin plugins like expo,expo-module,react-native-screens,react-native-gestlure-handler etc.. How can I solve this?

Can you create a small reproducer usign this template? https://github.com/react-native-community/reproducer-react-native

@recepaltas
Copy link
Author

@cortinico
When I create the project

  • npx react-native@latest init Project --> minifyEnabled = true. -> No Problem
  • npx create-react-native-app -> Blank Temlate -> minifyEnabled = true -> Error Same
    It has same error also npx react-native@latest init Project -> yarn add expo-core-modules -> Same Error

@cortinico
Copy link
Contributor

  • npx create-react-native-app -> Blank Temlate -> minifyEnabled = true -> Error Same
    It has same error also npx react-native@latest init Project -> yarn add expo-core-modules -> Same Error

Then this is not a problem with React Native core but with either:

  1. create-react-native-app -> should be reported here https://github.com/expo/create-react-native-app/issues
  2. Expo Core Modules -> should be reported here https://github.com/expo/expo/issues

@hotaryuzaki
Copy link

add this in your android/build.gradle
(this is for latest RN version 0.72.6)

buildscript {
    ext {
        ...
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'
    }
    dependencies {
        ...
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
    }

my another project kotlinVersion is 1.6.10 for RN 0.71.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Transforms Needs: Attention Issues where the author has responded to feedback. Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library
Projects
None yet
Development

No branches or pull requests

5 participants