找不到android.support.v7.widget.Toolbar

时间:2019-08-30 07:54:56

标签: android android-support-library android-toolbar android-appcompat androidx

应用级别的build.gradle文件如下所示

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

    android {
        compileSdkVersion 28
        buildToolsVersion "28.0.3"
        defaultConfig {
            applicationId "com.example.sscmessenger"
            minSdkVersion 19
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner 
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   //noinspection GradleCompatible
   implementation 'com.android.support:design:28.0.0-rc01'
   implementation 'com.android.support:support-v4:28.0.0-rc01'
   implementation 'com.firebaseui:firebase-ui-database:3.2.2'
   implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
   implementation 'com.google.firebase:firebase-auth:19.0.0'
   implementation 'com.google.firebase:firebase-database:19.0.0'
   testImplementation 'junit:junit:4.12'
   implementation 'com.android.support:appcompat-v7:28.0.3'


   }
  

Blockquote

1 个答案:

答案 0 :(得分:0)

android.support.v7.widget.Toolbar可以在appcompat库中找到。

请注意,因为

implementation 'com.android.support:appcompat-v7:28.0.3'

不存在。
28.0.0是支持库的最新版本。

更改依赖项:

   implementation 'com.android.support:design:28.0.0'
   implementation 'com.android.support:support-v4:28.0.0'
   implementation 'com.android.support:appcompat-v7:28.0.0'
   //...

更好地migrate您的项目到 androidx