它给了我错误
build.gradel(项目)
buildscript {
repositories {
jcenter()
}
}
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
build.gradel(应用程序)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.meowbotm"
minSdk 21
targetSdk 32
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
}
我还在 Gradel 属性中添加了以下几行
android.useAndroidX=true
android.enableJetifier=true
我不知道是什么问题,在 YT 和网站上它显示这些依赖关系足够并且 meowbottom bar 正在工作。
你必须在你的xml文件中使用这个标签来实现,然后它才能工作。因为您使用的是 1.2.0 版本。
<com.etebarian.meowbottomnavigation.MeowBottomNavigation
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btm_nav"
android:layout_gravity="bottom"
app:mbn_backgroundBottomColor="@color/purple_200"
app:mbn_circleColor="@color/white"
app:mbn_selectedIconColor="@color/purple_200"
app:mbn_defaultIconColor="@color/white"/>
您只需添加:
jcenter()" settings.gradle->dependencyResolutionManagement->repositories
this error show for every github library
Failed to resolve: com.etebarian:meow-bottom-navigation:1.3.1
Show in Project Structure dialog
Affected Modules: app
Failed to resolve: com.github.barteksc:android-pdf-viewer:2.8.2
Show in Project Structure dialog
Show Details
Affected Modules: app
设置.gradle
`pluginManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android") {
useVersion("8.2.1") // Make sure this matches your project's version
}
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) // Allows repositories in build.gradle.kts
// repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://jitpack.io")
}
}
}
rootProject.name = "Nafis Coaching Center"
include(":app")`
**build.gradle**
`plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.gms.google-services")
}
android {
namespace = "com.example.nafisquaisarcoachingcenter"
compileSdk = 34
buildFeatures {
viewBinding = true
}
defaultConfig {
applicationId = "com.example.nafisquaisarcoachingcenter"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt")
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.firebase:firebase-auth:23.0.0")
implementation("com.google.android.gms:play-services-auth:21.2.0")
implementation("androidx.navigation:navigation-ui-ktx:2.8.0")
implementation("com.google.firebase:firebase-database:21.0.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.8.0")
implementation("com.google.firebase:firebase-firestore:25.1.0")
implementation("com.google.firebase:firebase-storage-ktx:21.0.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
implementation("com.github.denzcoskun:ImageSlideshow:0.1.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20")
implementation("com.intuit.sdp:sdp-android:1.1.1")
// pdf viewer dependency
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation ("com.github.barteksc:android-pdf-viewer:2.8.2")
implementation ("com.etebarian:meow-bottom-navigation:1.3.1")
implementation ("androidx.multidex:multidex:2.0.1") // If multidex is enabled
`