Duplicate class kotlin.random.jdk8 found in modules jetified-kotlin-stdlib-1.8.10, with start-up benchmark

huangapple go评论79阅读模式
英文:

Duplicate class kotlin.random.jdk8 found in modules jetified-kotlin-stdlib-1.8.10, with start-up benchmark

问题

抱歉,代码部分不需要翻译。以下是翻译好的内容:

当尝试测量我的应用程序的启动性能时,出现了此错误。但是使用普通的安装,应用程序成功启动。我尝试在build.gradle中删除任何重复的实现,但错误未得到解决。我尝试删除jdk7,但没有任何变化。我该如何解决这个错误?

英文:

When trying to measure the startup performance of my app, this error appeared. But with the normal installation, the application started successfully. I tried to remove any duplicate implementations in build.gradle, but the error is not fixed. I tried to remove jdk7, but nothing changed. How can I solve this error?

Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.io.path.DirectoryEntriesReader found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)

build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-android-extensions'
    id 'kotlin-kapt'
    id 'kotlin-android'
    id "androidx.navigation.safeargs.kotlin"
    id 'com.google.gms.google-services'
    // Add the Performance Monitoring Gradle plugin
    id 'com.google.firebase.firebase-perf'
}

android {
    namespace 'com.eltohamyM.egydate'
    compileSdk 33

    buildFeatures {
        dataBinding true
        viewBinding true
    }

    defaultConfig {
        applicationId "com.eltohamyM.egydate"
        minSdk 30
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        benchmark {
            signingConfig signingConfigs.debug
            matchingFallbacks = ['release']
            debuggable false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    //Navigation
    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.recyclerview:recyclerview:1.3.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.google.code.gson:gson:2.9.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.test.ext:junit-ktx:1.1.5'
    implementation 'junit:junit:4.13.2'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    // Core library
    androidTestImplementation 'androidx.test:core:1.5.0'
// AndroidJUnitRunner and JUnit Rules
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'androidx.test:rules:1.5.0'
// Espresso dependencies
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'

    //Addition
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0")
    implementation("app.futured.hauler:hauler:5.0.0")
    // optional dependency with set of Data Binding adapters
    implementation("app.futured.hauler:databinding:5.0.0")
    implementation 'com.github.davidmigloz:drag-to-close:1.0.0'
    implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
    implementation "com.github.firdausmaulan:GlideSlider:1.5.2"
    implementation  'io.ak1.pix:piximagepicker:1.6.3'
    implementation 'com.iceteck.silicompressorr:silicompressor:2.2.4'
    implementation 'com.github.SimformSolutionsPvtLtd:SSImagePicker:2.0'
    implementation 'com.github.Mindinventory:Lassi:1.1.0' //Image Picker
    implementation "com.vanniktech:emoji-material:0.15.0"
    implementation "com.vanniktech:emoji-google:0.15.0"
    implementation "com.vanniktech:emoji-facebook:0.15.0"
    implementation "com.vanniktech:emoji-twitter:0.15.0"
    implementation "com.vanniktech:emoji-google-compat:0.15.0"
    implementation "com.vanniktech:emoji:0.15.0"
    implementation "com.vanniktech:emoji:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-ios:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-google:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-google-compat:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-twitter:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-facebook:0.16.0-SNAPSHOT"
    implementation "com.vanniktech:emoji-material:0.16.0-SNAPSHOT"

    implementation 'com.github.alxrm:audiowave-progressbar:0.9.2'
    implementation 'com.github.Armen101:AudioRecordView:1.0.5'
    implementation 'com.github.GitHubZJY:AudioVisualizeView:v1.0.0'
    implementation  'com.github.massoudss:waveformSeekBar:5.0.2'
    // Amplitude will allow you to call setSampleFrom() with files, URLs, Uri and resources
    // Important: Only works with api level 21 and higher
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.squti:Android-Wave-Recorder:1.7.0'
    //implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
    //for AndroidX use:
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.github.dhaval2404:imagepicker:2.1'
    implementation 'com.github.Drjacky:ImagePicker:2.3.22'
    implementation 'com.github.raheemadamboev:image-radio-button-android:1.0.4'
    implementation "com.github.skydoves:powerspinner:1.2.4"
    implementation "xyz.schwaab:avvylib:1.2.0"
    implementation 'com.hbb20:ccp:2.7.0'
    implementation 'com.github.togisoft:jetpack_compose_country_code_picker:1.1.4'
    implementation 'com.github.TuleSimon:xMaterialccp:1.11'
    implementation 'com.github.vardemin.MaterialCountryPicker:materialcountrypicker:0.2.3'
    implementation 'com.github.Ferfalk:SimpleSearchView:0.2.0'
    implementation 'com.github.zcweng:switch-button:0.0.3@aar'
    implementation 'nl.bryanderidder:themed-toggle-button-group:1.4.1'
    implementation 'com.github.alirezat775:carousel-view:1.1.1' //Carousel View
    implementation 'com.github.iammert:ReadableBottomBar:0.2' //Readable Bottom Bar
    implementation 'com.github.ismaeldivita:chip-navigation-bar:1.4.0'
    implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.7.9'
    implementation 'nl.joery.animatedbottombar:library:1.1.0' //My Animated Bottom Bar, Thanks
    implementation 'com.github.GoodieBag:Pinview:v1.5'
    implementation 'androidx.activity:activity-compose:1.6.1'
    implementation 'io.github.chaosleung:pinview:1.4.4'
    implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
    implementation "com.github.pgreze:android-reactions:1.3"
    implementation 'com.github.3llomi:CircularStatusView:V1.0.3'
    implementation 'com.github.OMARIHAMZA:StoryView:1.0.2-alpha'

    //Coil
    implementation("io.coil-kt:coil:2.2.2")

    kapt "com.android.databinding:compiler:3.1.4"

    //Kotlin components
    kapt "org.jetbrains.kotlin:kotlin-stdlib:1.8.10"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"

    //glide
    def glide_version = "4.14.2"
    implementation "com.github.bumptech.glide:glide:$glide_version"
    annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

    //Room for database
    def room_version = "2.5.0"

    implementation("androidx.room:room-runtime:$room_version")
    implementation("androidx.room:room-ktx:$room_version")
    androidTestImplementation("androidx.room:room-testing:$room_version")
    kapt "androidx.room:room-compiler:$room_version"

    // Extensions = ViewModel + LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation "androidx.lifecycle:lifecycle-common-java8:2.6.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0"

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.6.2'
    //GSON
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
    //Logging
    implementation 'com.squareup.okhttp3:okhttp:4.10.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'

    //
    implementation 'com.github.mohammadatif:Animatoo:master'
    //Camera Access
    implementation "androidx.camera:camera-camera2:1.2.1"
    implementation "androidx.camera:camera-lifecycle:1.2.1"
    implementation "androidx.camera:camera-view:1.2.1"
    implementation "androidx.camera:camera-video:1.2.1"
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'pub.devrel:easypermissions:3.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation "android.arch.lifecycle:extensions:1.1.1"
    implementation 'com.google.android.exoplayer:exoplayer:2.18.4'
    implementation 'com.github.JarvanMo:ExoVideoView:2.1.6'
    // for core support in exoplayer.
    implementation "com.google.android.exoplayer:exoplayer-core:2.18.4"
// for adding dash support in our exoplayer.
    implementation "com.google.android.exoplayer:exoplayer-dash:2.18.4"
// for adding hls support in exoplayer.
    implementation "com.google.android.exoplayer:exoplayer-hls:2.18.4"
// for smooth streaming of video in our exoplayer.
    implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:2.18.4"
// for generating default ui of exoplayer
    implementation "com.google.android.exoplayer:exoplayer-ui:2.18.4"
    // CameraX dependencies (first release for video is: "1.1.0-alpha10")
    def camerax_version = "1.1.0-beta01"
    // The following line is optional, as the core library is included indirectly by camera-camera2
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-video:${camerax_version}"
    implementation "androidx.camera:camera-view:${camerax_version}"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.6.4"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4'

    // Profiler
    implementation "androidx.profileinstaller:profileinstaller:1.3.0-rc01"
    implementation 'androidx.annotation:annotation:1.6.0'

    // Firebase
    implementation "dev.priyankvasa.android:cameraview-ex:3.5.5-alpha"
    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.2'

    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:31.2.3')
    // When using the BoM, don't specify versions in Firebase dependencies
    implementation 'com.google.firebase:firebase-analytics-ktx'
    // Import the BoM for the Firebase platform
    // Add the dependency for the Firebase Authentication library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.google.firebase:firebase-firestore-ktx:24.4.4'
    implementation 'androidx.browser:browser:1.5.0'  //
    implementation 'com.google.firebase:firebase-messaging-ktx'
    // Add the dependency for the Performance Monitoring library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-perf-ktx'
    implementation 'com.google.firebase:firebase-database'
    implementation 'com.google.firebase:firebase-storage'
}

build.gradle (benchmark)

plugins {
    id 'com.android.test'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.eltohamy.benchmark'
    compileSdk 33

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    defaultConfig {
        minSdk 24
        targetSdk 33

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        // This benchmark buildType is used for benchmarking, and should function like your
        // release build (for example, with minification on). It's signed with a debug key
        // for easy local/CI testing.
        benchmark {
            debuggable = true
            signingConfig = debug.signingConfig
            matchingFallbacks = ["release"]
            proguardFiles("benchmark-rules.pro")
        }
    }

    targetProjectPath = ":app"
    experimentalProperties["android.experimental.self-instrumenting"] = true
}

dependencies {
    implementation 'androidx.test.ext:junit:1.1.5'
    implementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    implementation 'androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha11'
}

androidComponents {
    beforeVariants(selector().all()) {
        enabled = buildType == "benchmark"
    }
}

utils/build.gradle

/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 33

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'
    }

    compileOptions {
        sourceCompatibility rootProject.ext.java_version
        targetCompatibility rootProject.ext.java_version
    }

    kotlinOptions {
        jvmTarget = "$rootProject.ext.java_version"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    // Kotlin lang
    kapt "org.jetbrains.kotlin:kotlin-stdlib:1.8.10"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'

    // App compat and UI things
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.recyclerview:recyclerview:1.3.0'

    // EXIF Interface
    implementation 'androidx.exifinterface:exifinterface:1.3.6'

    // Unit testing
    testImplementation 'androidx.test.ext:junit:1.1.5'
    testImplementation 'androidx.test:rules:1.5.0'
    testImplementation 'androidx.test:runner:1.5.2'
    testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    testImplementation 'org.robolectric:robolectric:4.3.1'

    // Instrumented testing
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test:rules:1.5.0'
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

build.gradle (application)

buildscript {
    ext.kotlin_version = "1.7.21"
    repositories {
        google()
        mavenCentral()
        maven { url='https://jitpack.io'}
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath 'junit:junit:4.13.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04"
        classpath 'com.google.gms:google-services:4.3.15'
        // Add the dependency for the Performance Monitoring Gradle plugin
        classpath 'com.google.firebase:perf-plugin:1.4.2'
    }
}
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.21' apply false
    id 'com.android.test' version '7.4.2' apply false
}
allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io'}
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

答案1

得分: 32

尝试包括以下依赖项:

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

对我有效。。

参考此文章以获取更多信息:https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7

英文:

Try including following dependency

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

Worked for me..

Refer this article for more info: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7

答案2

得分: 2

I believe the correct way to handle this problem is to specify a constraint instead of adding another dependency, as described in the Gradle userguide

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because 'align all versions of kotlin transitive dependencies'
}
}

You can add constraints for jdk7 too if necessary.

Original answer here

英文:

I believe the correct way to handle this problem is to specify a constraint instead of adding another dependency, as described in the Gradle userguide

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because 'align all versions of kotlin transitive dependencies'
}
}

You can add constraints for jdk7 too if necessary.

Original answer here

答案3

得分: 0

这是帮助我,您也可以尝试解决您的问题。

实现(平台("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

英文:

This is Help for me You can also try to solve your problem.

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

huangapple
  • 本文由 发表于 2023年3月12日 19:48:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定