bridgefy / bridgefy-react-native

The Bridgefy Software Development Kit (SDK) is a state-of-the-art, plug-and-play package that will let people use your mobile app when they don’t have access to the Internet, by using Bluetooth mesh networks.
MIT License
11 stars 4 forks source link

Can't compile for Android #32

Closed antoinerousseau closed 2 months ago

antoinerousseau commented 2 months ago

Can't compile an Android version using bridgefy-react-native 1.1.5 and RN 0.72.15

I'm getting this error:

> Task :app:dexBuilderLocalDebug FAILED
ERROR:D8: Invalid build configuration. Attempt to create a global synthetic for 'Record desugaring' without a global-synthetics consumer.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexBuilderLocalDebug'.
> Could not resolve all files for configuration ':app:detachedConfiguration6'.
   > Failed to transform jetified-libsignal-client-0.49.0.jar to match attributes {artifactType=ext-dex-dexBuilderLocalDebug, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingExternalLibArtifactTransform: /Users/antoine/.gradle/caches/transforms-3/e1fd56cea5e5edc249838546abac6b5d/transformed/jetified-libsignal-client-0.49.0.jar.
         > Error while dexing.

The error disappears when I remove the bridgefy-react-native dependency.

mike-bridgefy commented 2 months ago

Hi @antoinerousseau We are sorry you had this problem. Can you try adding these configurations? Just as we have in the example/android/app/build.gradle

android {
     ...
     compileOptions {
           sourceCompatibility JavaVersion.VERSION_17
            targetCompatibility JavaVersion.VERSION_17
            coreLibraryDesugaringEnabled true
       }
       kotlinOptions {
           jvmTarget = '17'
       }
       ...
}
...
dependencies {
    ...
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
    ...
}
...
antoinerousseau commented 2 months ago

Thanks for the quick response. Tried it... Now I'm getting this:

> Task :app:mergeExtDexLocalDebug FAILED

ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: Invalid build configuration. Attempt to create a global synthetic for 'Record desugaring' without a global-synthetics consumer.
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexLocalDebug'.
> Could not resolve all files for configuration ':app:localDebugRuntimeClasspath'.
   > Failed to transform android-sdk-1.1.4.aar (me.bridgefy:android-sdk:1.1.4) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/5d03ef98eae9a62daafee120f29411b8/transformed/jetified-android-sdk-1.1.4-runtime.jar.
         > Error while dexing.
   > Failed to transform dbtools-room-8.3.0.aar (org.dbtools:dbtools-room:8.3.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/cb103faf03f72021732569aaba83f7fe/transformed/jetified-dbtools-room-8.3.0-runtime.jar.
         > Error while dexing.
   > Failed to transform kotlinx-coroutines-core-jvm-1.8.0.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/926e734d1e957ec9c72f7124f0121e7f/transformed/jetified-kotlinx-coroutines-core-jvm-1.8.0.jar.
         > Error while dexing.
   > Failed to transform kotlinx-coroutines-android-1.8.0.jar (org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/f81ff6074d3df7572ed94240cbdc80f0/transformed/jetified-kotlinx-coroutines-android-1.8.0.jar.
         > Error while dexing.
   > Failed to transform kotlinx-serialization-core-jvm-1.6.3.jar (org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.3) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/d784a21ef5b63e025e918070b6ad489d/transformed/jetified-kotlinx-serialization-core-jvm-1.6.3.jar.
         > Error while dexing.
   > Failed to transform kotlinx-serialization-json-jvm-1.6.3.jar (org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/3243417f4a4c2399ac082b661add16e5/transformed/jetified-kotlinx-serialization-json-jvm-1.6.3.jar.
         > Error while dexing.
   > Failed to transform retrofit-2.10.0.jar (com.squareup.retrofit2:retrofit:2.10.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/d0c03b3ef85832198eef63ca0402effb/transformed/jetified-retrofit-2.10.0.jar.
         > Error while dexing.
   > Failed to transform okio-jvm-3.6.0.jar (com.squareup.okio:okio-jvm:3.6.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/bab711e67355bb0dd50abf548b5cc39b/transformed/jetified-okio-jvm-3.6.0.jar.
         > Error while dexing.
   > Failed to transform kermit-debug.aar (co.touchlab:kermit-android-debug:2.0.2) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.BuildTypeAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/d025d43dc00e776109e9949eb387fa81/transformed/jetified-kermit-debug-runtime.jar.
         > Error while dexing.
   > Failed to transform kotlin-test-junit-1.9.10.jar (org.jetbrains.kotlin:kotlin-test-junit:1.9.10) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/718e73a51912a15bdf0aee5b23e26e13/transformed/jetified-kotlin-test-junit-1.9.10.jar.
         > Error while dexing.
   > Failed to transform kotlin-test-1.9.10.jar (org.jetbrains.kotlin:kotlin-test:1.9.10) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/48fbb54f85b317fdb1797d4af29ef2c1/transformed/jetified-kotlin-test-1.9.10.jar.
         > Error while dexing.
   > Failed to transform kotlin-stdlib-1.9.23.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.23) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.jvm.environment=standard-jvm, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/a5e0b4f3a05ce862a6614d6bb53279d1/transformed/jetified-kotlin-stdlib-1.9.23.jar.
         > Error while dexing.
   > Failed to transform kermit-core-debug.aar (co.touchlab:kermit-core-android-debug:2.0.2) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.BuildTypeAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/f68b012a8d5e6f23fa7a88e2f725df40/transformed/jetified-kermit-core-debug-runtime.jar.
         > Error while dexing.
   > Failed to transform libsignal-client-0.49.0.jar (org.signal:libsignal-client:0.49.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=17, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/antoine/.gradle/caches/transforms-3/e1fd56cea5e5edc249838546abac6b5d/transformed/jetified-libsignal-client-0.49.0.jar.
         > Error while dexing.
antoinerousseau commented 2 months ago

Okay I'm able to compile by bumping React-Native to 0.73! You could add this in your requirements

"peerDependencies": {
    "react-native": ">=0.73"
  },
antoinerousseau commented 2 months ago

also, fyi, I was able to remove coreLibraryDesugaringEnabled true and the coreLibraryDesugaring dep from my code