com.google.android.material.R Не удается разрешить символ 'R' для BottomNavigationView - PullRequest
0 голосов
/ 15 октября 2019

Я использую BottomNavigationView в своем приложении, но у меня есть проблема: в BottomNavigationView.java есть импорт com.google.android.material.R, а R красный и пишет: «Не удается разрешить символ« R »». Темы, которые я видел, не могли мне помочь.

Что бы вы мне порекомендовали?

Зависимости:

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.example.yourspeakingclub"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    sourceSets {
        main {
            java.srcDirs = ['src/main/java', 'src/main/java/Models', 'src/main/java/com/salendor/yourspeakingclub/models']
        }
    }
    buildToolsVersion = '28.0.3'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.android.support:support-compat'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    testImplementation 'junit:junit:4.13-beta-3'
    androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
    implementation 'com.google.android.material:material:1.1.0-beta01'
}

Макет:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/navigation_container_id"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?android:attr/actionBarSize">

<com.google.android.material.bottomnavigation.BottomNavigationView

    android:id="@+id/navigation_element"
    android:layout_width="wrap_content"
    android:layout_height="56dp"
    android:layout_gravity="start"
    android:background="?android:attr/windowBackground"
    app:itemTextColor="#000000"
    app:labelVisibilityMode="unlabeled"
    app:itemIconTint="@color/colorBlack"
    app:menu="@menu/bottom_menu" />

</FrameLayout>

Определение класса, где проблема с 'R', доступно здесь: https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomnavigation/BottomNavigationView.java

Спасибо

...