I cannot get TabLayout to resolve. I've tried implementing all the dependencies others have recommended for this issue, but it's still not working. Can anyone help? Is the issue that I'm trying to use older features alongside Androidx? Thanks
SECTION ONE: build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.instagramclone"
minSdkVersion 16
targetSdkVersion 30
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"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Design
implementation 'com.android.support:support-compat:30.0.0'
implementation "com.android.support:support-core-utils:30.0.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
implementation "com.android.support:design:30.0.0"
}
SECTION TWO: XML FILE
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true">
<com.google.android.material.appbar.AppBarLayout
android:layout_width='match_parent'
android:layout_height = 'wrap_content'>
<android.support.design.widget.TabLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/tabs"
android:background="@drawable/white_grey_border_bottom">
</android.support.design.widget.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
</RelativeLayout>
</merge>
The support libraries v.30.0.0
don't exist.
Remove these dependencies:
//Design
//implementation 'com.android.support:support-compat:30.0.0'
//implementation "com.android.support:support-core-utils:30.0.0"
//implementation "com.android.support:design:30.0.0"
For the TabLayout
add this dependency:
implementation 'com.google.android.material:material:1.1.0'
and use the class com.google.android.material.tabs.TabLayout