mapbox / mapbox/mapbox-navigation-android-examples

Unresolved reference:databinding

Ouverte
#143 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

jira-sync-complete
Langage dominant
Kotlin
Étoiles
65
Forks
56
Merge moyen
1 j 4 h
PR mergées (30 j)
2

Description

Hi,

I am trying to use the turn-by-turn navigation example, but I cannot resolve the reference:

import com.mapbox.navigation.examples.databinding.MapboxActivityTurnByTurnExperienceBinding

I am having a hard time just to fix this. Could anyone help me, please?

Here is gradle (project):

buildscript {
ext.kotlin_version = '1.7.20-RC'
repositories {
google()
mavenCentral()

}
dependencies {
    classpath "com.android.tools.build:gradle:7.0.4"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}
allprojects {
repositories {
google()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = System.getenv("MAPBOX_DOWNLOADS_TOKEN") ?: project.property("MAPBOX_DOWNLOADS_TOKEN") as String
}
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}


gradle (app)

plugins {
id 'com.android.application'

}
apply plugin: 'kotlin-android'

android {
compileSdk 32

defaultConfig {
    applicationId "com.example.android.testenavegacao"
    minSdk 21
    targetSdk 32
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

buildFeatures {
    viewBinding true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
    main {
        def srcDirs = file("$projectDir/src/main/java/com/mapbox/navigation/examples")
                .listFiles({ it.isDirectory() } as FileFilter)
                .collect { it.name }

        res.srcDirs = ['src/main/res']
        srcDirs.forEach {
            res.srcDirs += 'src/main/java/com/mapbox/navigation/examples/' + it + '/res'
        }
    }
}

configurations {
    all*.exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
}

}

dependencies {

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'androidx.core:core:1.8.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.9.1'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.libraries.maps:maps:3.1.0-beta'
implementation 'com.google.firebase:firebase-config:21.1.1'
implementation 'androidx.databinding:databinding-adapters:7.2.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation "androidx.core:core-ktx:1.8.0"
implementation "com.google.android.gms:play-services-location:20.0.0"
implementation "androidx.multidex:multidex:2.0.1"
implementation "com.squareup.leakcanary:leakcanary-android:2.8.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1"

implementation 'javax.annotation:javax.annotation-api:1.3.2'

implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'

implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.bumptech.glide:glide:3.7.0'

implementation 'com.mapbox.maps:android:10.7.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-core:5.0.2'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.11.0'

implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:6.7.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0'

    / Mapbox Navigation Android Auto SDK Developer Preview /
implementation("com.mapbox.navigation:ui-androidauto:0.8.0")
implementation "com.mapbox.navigation:ui-dropin:2.7.0"
implementation "com.mapbox.navigation:android:2.7.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'
implementation "androidx.core:core-ktx:+"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}
repositories {
mavenCentral()
}


settings.gradle

dependencyResolutionManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be mapbox (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = "pass-"
}
}
}
}
}
rootProject.name = "testenavegacao"
include ':app'

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par app/build.gradle et settings.gradle, puis examinez la configuration de viewBinding et sourceSets ainsi que l’import généré de MapboxActivityTurnByTurnExperienceBinding. Exécutez une synchronisation/un build Gradle pour déterminer pourquoi la référence n’est pas générée ; c’est terminé lorsque l’exemple compile avec la référence au binding résolue.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
android, kotlin
Domaine
build-system, mobile
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.