Closed HamedMohtadi closed 3 years ago
سلام لطفا محتوای این فایل رو هم قرار بدید: app/build.gradle
سلام. ممنون از کاری که انجام دادید. من هم این مشکل رو دارم. این محتوای گردل من هست. همین ارور رو دارم.
متن ارور: Duplicate class saman.zamani.persiandate.BuildConfig found in modules jetified-PersianDate-0.8-runtime.jar (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.3.2-runtime.jar (com.github.samanzamani:PersianDate:1.3.2) Duplicate class saman.zamani.persiandate.PersianDate found in modules jetified-PersianDate-0.8-runtime.jar (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.3.2-runtime.jar (com.github.samanzamani:PersianDate:1.3.2) Duplicate class saman.zamani.persiandate.PersianDateFormat found in modules jetified-PersianDate-0.8-runtime.jar (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.3.2-runtime.jar (com.github.samanzamani:PersianDate:1.3.2) Duplicate class saman.zamani.persiandate.PersianDateFormat$1 found in modules jetified-PersianDate-0.8-runtime.jar (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.3.2-runtime.jar (com.github.samanzamani:PersianDate:1.3.2) و اینکه یه کتابخونه دیتا پیکر تاریخ شمسی هم دارم واحتمال میدم مشکل از تداخل این دو باشه طبق این لینک https://developer.android.com/studio/build/dependencies#resolution_errors
Go to the documentation to learn how to Fix dependency resolution errors.
App Gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'kotlin-kapt'
apply plugin: 'org.jetbrains.kotlin.android.extensions'
apply plugin: 'com.google.gms.google-services'
//sourceSets {
// main {
// res.srcDirs =
// [
// 'src/main/res/layouts/shimmerlayout',
// 'src/main/res/layouts',
// 'src/main/res'
// ]
// }
//}
android {
buildFeatures {
dataBinding true
}
androidExtensions {
experimental = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
applicationId "mythird.simpleloginregister"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layout/layouts_main',
'src/main/res/layout',
'src/main/res'
]
}
}
}
dependencies {
configurations ->
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'androidx.work:work-runtime:2.3.4'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.github.belljay:SwitchButton:1.0.4'
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:29.0.1')
// Declare the dependencies for the Firebase Cloud Messaging and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-messaging-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
// implementation "com.google.dagger:hilt-android:2.34-beta"
// kapt "com.google.dagger:hilt-compiler:2.34-beta"
//for viewpager 2 and sync with tablayout
implementation "androidx.viewpager2:viewpager2:1.0.0"
//data picker
implementation 'com.github.aliab:Persian-Date-Picker-Dialog:1.6.1'
//convert georgian to shamsi date
implementation 'com.github.samanzamani:PersianDate:1.3.2'
//it is for lifecycle
// Lifecycle-aware components perform actions in response to a change in the lifecycle status of another component,
// such as activities and fragments. These components help you produce better-organized, and often lighter-weight code, that is easier to maintain.
def lifecycle_version = "2.4.0-rc01"
// ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
// LiveData
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version")
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
//
// implementation "com.google.dagger:hilt-android:$hilt_version"
// kapt "com.google.dagger:hilt-compiler:$hilt_version"
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
// implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'org.altbeacon:android-beacon-library:2.17.1'
implementation 'com.neovisionaries:nv-bluetooth:1.8'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.android.support:design:29.0.2'
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.3.2"
implementation 'com.google.android.material:material:1.5.0-alpha01'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.3.2"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'io.reactivex.rxjava3:rxjava:3.0.3'
implementation "com.squareup.okhttp3:logging-interceptor:4.6.0"
implementation 'com.squareup.okhttp3:okhttp:4.6.0'
implementation 'tech.gusavila92:java-android-websocket-client:1.2.2'
implementation 'com.github.f0ris.sweetalert:library:1.6.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
//room database
implementation 'androidx.room:room-ktx:2.3.0'
kapt "androidx.room:room-compiler:2.3.0"
def room_version = "2.3.0"
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor "androidx.room:room-compiler:$room_version"
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")
def lottieVersion= "3.4.0"
//navigation in room databae library
def nav_version = '2.3.5'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation 'android.arch.navigation:navigation-ui:1.0.0'
//lottie animation libs
implementation "com.airbnb.android:lottie:$lottieVersion"
}
سلام بعد از اضافه کردن به پروژه و بیلد کردن به ارور زیر بر می خوریم:
Duplicate class saman.zamani.persiandate.BuildConfig found in modules jetified-PersianDate-0.8-runtime (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.1-runtime (com.github.samanzamani:PersianDate:1.1) Duplicate class saman.zamani.persiandate.PersianDate found in modules jetified-PersianDate-0.8-runtime (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.1-runtime (com.github.samanzamani:PersianDate:1.1) Duplicate class saman.zamani.persiandate.PersianDateFormat found in modules jetified-PersianDate-0.8-runtime (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.1-runtime (com.github.samanzamani:PersianDate:1.1) Duplicate class saman.zamani.persiandate.PersianDateFormat$1 found in modules jetified-PersianDate-0.8-runtime (com.github.samanzamani.persiandate:PersianDate:0.8) and jetified-PersianDate-1.1-runtime (com.github.samanzamani:PersianDate:1.1)
برای من مشکل از کتابخونه دیتاپیکر فارسی هست که از این کتابخونه استفاده کرده. نمیدونم شما هم این کتابخونه رو دارید یا نه. و ائن کتابخونه از ورژن قدیمی تر 0.8 استفاده کرده. برای همین وقتی این کتابخونه و اون کتابخونه رو با هم اضافه میکنیم این مغایرت به وجود میاد. برای همین این خط کد رو به کتابخونه دیتاپیکر یا هر کتابخونه دیگه که دارید اضافه کنید. که از ورژن قدیمی تر استفاده نکنه. implementation ('com.github.aliab:Persian-Date-Picker-Dialog:1.6.1') {exclude group:"com.github.samanzamani.persiandate" , module:"PersianDate"}
سلام بعد از اضافه کردن به پروژه و بیلد کردن به ارور زیر بر می خوریم: