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

[Bug]: Execution failed for task ':rnmapbox_maps:compileDebugKotlin' #3480

Closed
fixer4013 opened this issue May 8, 2024 · 13 comments · Fixed by #3481
Closed

[Bug]: Execution failed for task ':rnmapbox_maps:compileDebugKotlin' #3480

fixer4013 opened this issue May 8, 2024 · 13 comments · Fixed by #3481
Labels
bug 🪲 Something isn't working

Comments

@fixer4013
Copy link

Mapbox Implementation

Mapbox

Mapbox Version

10.17.0

React Native Version

0.72.7

Platform

Android

@rnmapbox/maps version

10.1.21

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Good day, in an attempt to run my project on android after updating to the 10.1.21 version, I get this error rnmapbox_maps:compileDebugKotlin: failed. I was wondering what the workaround fix for this might be. From what I can see the latest update is related to the PrivacyInfo files for the IOS build where I have no issues, but android does not seem to like them.

e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (324, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (328, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (332, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (336, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (340, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (344, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (348, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (352, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (356, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (360, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (364, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (368, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (372, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (376, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (380, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (384, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (388, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt: (392, 5): Unresolved reference: TODO
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/style.kt: (7, 63): Unresolved reference: HashMap
e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/style.kt: (8, 12): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/martinyankov/.gradle/caches/transforms-3/29b84db2cdfda5f4957ed70faa28c917/transformed/jetified-kotlin-stdlib-1.9.21.jar!/kotlin/Unit.class

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':rnmapbox_maps:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 28s
error Failed to install the app.
info Run CLI with --verbose flag for more details.
martinyankov@Martins-Mac-mini immotech-app % 

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

@fixer4013 fixer4013 added the bug 🪲 Something isn't working label May 8, 2024
@mfazekas
Copy link
Contributor

mfazekas commented May 8, 2024

It sounds strange as TODO is in Kotlin stdlib.

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-t-o-d-o.html

Most likely the root cause is that you have Kotlin 1.7.1 and @rnmapbox/maps uses libs that were built using kotlin 1.9

e: /Users/martinyankov/immotech/immotech-app/node_modules/@rnmapbox/maps/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/style.kt: (8, 12): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

See https://github.com/rnmapbox/maps/pull/3465/files

You might be able to work around that using

kotlinxCoroutinesCoreVersion = 1.6.4
kotlinxCoroutinesAndroidVersion = 1.6.4

Add this to your andorid/build.gradle file after kotlinVersion = 1.7... in buildscript { ext {

@OverStackedLab
Copy link

OverStackedLab commented May 12, 2024

This is what I'm running and it's working:

// android/build.gradle
ext {
  ...
   kotlinVersion = '1.8.0'
}
...
dependencies {
  ...
    classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0')
 }

"@rnmapbox/maps": "^10.1.21",

@Syed-Anas-Ahmed
Copy link

I created a bare Expo project and just installed the @rnmapbox/maps package and setup the download key. Upon running the dev build (npx expo run:android), it's still throwing this error.

Mapbox Version: 10.1.30
RN Version: 0.74.5

My build.gradle file looks like this


buildscript {
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'

        ndkVersion = "26.1.10909125"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
    }
}

apply plugin: "com.facebook.react.rootproject"

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}
// @generated begin @rnmapbox/maps-v2-maven - expo prebuild (DO NOT MODIFY) sync-32f1b7024bb5099f2805443b1960a3233ccde124

allprojects {
  repositories {
    maven {
      url 'https://api.mapbox.com/downloads/v2/releases/maven'
      authentication { basic(BasicAuthentication) }
      credentials {
        username = 'mapbox'
        password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
      }
    }
  }
}

// @generated end @rnmapbox/maps-v2-maven```

@tdavis10
Copy link

tdavis10 commented Sep 6, 2024

I created a bare Expo project and just installed the @rnmapbox/maps package and setup the download key. Upon running the dev build (npx expo run:android), it's still throwing this error.

Mapbox Version: 10.1.30 RN Version: 0.74.5

My build.gradle file looks like this


buildscript {
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'

        ndkVersion = "26.1.10909125"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
    }
}

apply plugin: "com.facebook.react.rootproject"

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}
// @generated begin @rnmapbox/maps-v2-maven - expo prebuild (DO NOT MODIFY) sync-32f1b7024bb5099f2805443b1960a3233ccde124

allprojects {
  repositories {
    maven {
      url 'https://api.mapbox.com/downloads/v2/releases/maven'
      authentication { basic(BasicAuthentication) }
      credentials {
        username = 'mapbox'
        password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
      }
    }
  }
}

// @generated end @rnmapbox/maps-v2-maven```

@Syed-Anas-Ahmed Did you ever figure this out? i have the same versioning as you and running into the same error

@Syed-Anas-Ahmed
Copy link

Syed-Anas-Ahmed commented Sep 6, 2024

@tdavis10 Downgraded to 10.1.29 and it works

@SaleemMaini
Copy link

I tried all the mentioned solutions in this discussion and nothing worked. still have the same error.
versions
"react-native": "0.74.5"
"@rnmapbox/maps": "^10.1.21"
"RNMapboxMapsVersion": "10.17.0",

@Syed-Anas-Ahmed
Copy link

I tried all the mentioned solutions in this discussion and nothing worked. still have the same error.
versions
"react-native": "0.74.5"
"@rnmapbox/maps": "^10.1.21"
"RNMapboxMapsVersion": "10.17.0",

Is 10.1.29 not working too?

@SaleemMaini
Copy link

I tried all the mentioned solutions in this discussion and nothing worked. still have the same error.
versions
"react-native": "0.74.5"
"@rnmapbox/maps": "^10.1.21"
"RNMapboxMapsVersion": "10.17.0",

Is 10.1.29 not working too?

yes I tried it also didn't work

@SaleemMaini
Copy link

finally it's worked on 10.1.31-rc.1

@brunobarretta
Copy link

Upgrade to 10.1.31 and it works

@Xx-Parks-xX
Copy link

Oh thanks, upgrading to 10.1.31 works for me also

@fionhua
Copy link

fionhua commented Oct 3, 2024

果然,升级到 10.1.31 也对我有用

@ramchandru97
Copy link

buildscript {
ext {
buildToolsVersion = "34.0.0" // Changed to stable build tools version
minSdkVersion = 24
compileSdkVersion = 34 // Set to stable compileSdkVersion
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = '1.9.0' // Updated to 1.9.0 as per requirement
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.2") // Added specific version for stability
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}

allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = 'mapbox'
password = project.findProperty('MAPBOX_DOWNLOADS_TOKEN') ?: ""
}
}
}
}

apply plugin: "com.facebook.react.rootproject"

"dependencies": {
"@rnmapbox/maps": "^10.1.31",
"react": "18.3.1",
"react-native": "0.76.0"
},

still i'm getting same issue => > Task :rnmapbox_maps:compileDebugKotlin FAILED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants