homeeondemand/react-native-mapbox-navigation

Followed the steps to installation and I get a maven + sdk error for android

Opened this issue · 5 comments

errors
Errors are still not fixed after months ... any solutions?

Facing the same issue on Android.
This issue has already been addressed ig.
#67

Replace the code with ./node_modules/@homee/react-native-mapbox-navigation/android/build.gradle

// android/build.gradle

def DEFAULT_COMPILE_SDK_VERSION = 33
def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0'
def DEFAULT_MIN_SDK_VERSION = 24
def DEFAULT_TARGET_SDK_VERSION = 33

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

buildscript {
ext.kotlin_version = '1.6.20'
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
if (project == rootProject) {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}

repositories {
    mavenCentral()
}

dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

repositories {
// ref: https://www.baeldung.com/maven-local-repository
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
jcenter()
}

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.mapbox.navigation:core:1.5.0'
implementation 'com.mapbox.navigation:ui:1.5.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

def configureReactNativePom(def pom) {
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

pom.project {
    name packageJson.title
    artifactId packageJson.name
    version = packageJson.version
    group = "com.homee.mapboxnavigation"
    description packageJson.description
    url packageJson.repository.baseUrl

    licenses {
        license {
            name packageJson.license
            url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
            distribution 'repo'
        }
    }
}

}

afterEvaluate { project ->
android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
def javaCompileTask = variant.javaCompileProvider.get()

    task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
        from javaCompileTask.destinationDir
    }
}

}

@spaceod you are a legend! Many thanks

you save the day bro...was just thinking to create one from scratch!

Sorry, I'm new to all this. What exactly am I replacing here?