找到了多个具有 OS 个独立路径的文件
More than one file was found with OS independent path
我在图书馆工作:
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
我正在尝试集成 com.google.android.material.bottomappbar.BottomAppBar
但是当我 运行 应用程序时 returns 出现以下错误:
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" />
清单:
<?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>
非常感谢,希望你能帮我解决我的问题。
您正在使用两个不同但相关的 appcompat
版本,这导致了冲突错误。从您的应用级别 build.gradle
:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
您同时使用旧 support
版本和新 androidx
版本。两者都包含文件 META-INF/androidx.vectordrawable_vectordrawable.version
。使用其中之一,但不能同时使用。
您使用的是一些可能与 Androidx 库冲突的旧支持库。您可以查看 Migrating to AndroidX 文档,了解哪些支持库可以移至 Androidx。
我在图书馆工作:
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
我正在尝试集成 com.google.android.material.bottomappbar.BottomAppBar
但是当我 运行 应用程序时 returns 出现以下错误:
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" />
清单:
<?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>
非常感谢,希望你能帮我解决我的问题。
您正在使用两个不同但相关的 appcompat
版本,这导致了冲突错误。从您的应用级别 build.gradle
:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
您同时使用旧 support
版本和新 androidx
版本。两者都包含文件 META-INF/androidx.vectordrawable_vectordrawable.version
。使用其中之一,但不能同时使用。
您使用的是一些可能与 Androidx 库冲突的旧支持库。您可以查看 Migrating to AndroidX 文档,了解哪些支持库可以移至 Androidx。