Reputation: 57
I am working with the library:
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
I am trying to integrate com.google.android.material.bottomappbar.BottomAppBar
but when I run the application it returns the following error:
More than one file was found with OS independent path 'META-INF/androidx.vectordrawable_vectordrawable.version'
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "gregorio.com.mx.ejemplo"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'com.google.android.material:material:1.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
//Butterknife
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//Airbnb
implementation 'com.airbnb.android:lottie:2.5.4'
//Glide
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
//CircleImage
implementation 'de.hdodenhof:circleimageview:2.2.0'
//Volley
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'}
XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SplashScreen">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:padding="16dp"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hola"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ocultar/Mostrar FAB" />
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
style="@style/Widget.MaterialComponents.BottomAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:hideOnScroll="true"
app:fabCradleMargin="12dp"
app:fabCradleVerticalOffset="12dp"
app:fabCradleRoundedCornerRadius="24dp"
app:backgroundTint="@color/design_default_color_primary"
app:fabAlignmentMode="center"
app:navigationIcon="@drawable/ic_menu" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add"
app:backgroundTint="@color/design_default_color_primary_dark"
app:elevation="0dp"
app:layout_anchor="@id/bar" />
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cesarmanuel.com.mx.guanajuato">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString">
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
Thank you very much, I hope you can help me resolve my question.
Upvotes: 3
Views: 5645
Reputation: 353
Goto to yourProject/app/build.gradle inside android{}
android {
packagingOptions {
pickFirst 'the/NameOfThe/lib.so'
pickFirst '**/*.so' //if you dont know the name of the library
}
}
Upvotes: 0
Reputation: 10280
You're using two distinct but related versions of appcompat
which is causing the conflict error. From your app-level build.gradle
:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
You're using both the old support
version and the new androidx
version side by side. Both contain the file META-INF/androidx.vectordrawable_vectordrawable.version
. Use one or the other, but not both.
You're using a number of older support libraries which may conflict with Androidx libraries. You can see which support libraries can be moved to Androidx by looking at the Migrating to AndroidX documentation.
Upvotes: 3