Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class io.netty.channel.epoll.AbstractEpollChannel found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$3 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class io.netty.channel.epoll.AbstractEpollChannel found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$3 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class io.netty.channel.epoll.AbstractEpollChannel found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$1 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$2 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
     Duplicate class io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$3 found in modules jetified-netty-transport-native-epoll-4.1.67-linux-x86_64.Final-linux-x86_64 (io.netty:netty-transport-native-epoll:4.1.67.Final) and jetified-netty-transport-native-epoll-4.1.67.Final (io.netty:netty-transport-native-epoll:4.1.67.Final)
:
:
:
:
:
:

 

対応方法は以下

build.gradle

implementation( group: 'io.appium', name: 'java-client', version: '8.0.0-beta') {
    exclude group: 'io.netty', module: 'netty-transport-native-epoll'
    exclude group: 'io.netty', module: 'netty-transport-native-kqueue'
    exclude group: 'commons-logging', module: 'commons-logging'
}

基本的な考え方

io.netty:netty-transport-native-epoll

Dupulicate したグループとモジュールを指定して取り除く

group: io.netty

module : netty-transport-native-epoll

Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NoClassDefFoundError: javax/annotation/Generated

gradle 7.0.2 JDK11

dagger2 を試そうとしたらエラー

 

解決策、以下を追加

dependencies {
    annotationProcessor 'javax.annotation:javax.annotation-api:1.3.2'
}

 

AndroidStudio で Gradle7 を使うようになって JDK11 が必須となり、JDK1.8 のプロジェクトを JDK11 に切り替える必要があり頻繁にJDK11 と JDK1.8 を切り替える必要があり zsh の alias でしのいでいましたが行けていなかったので調査

結果以下で対応

.zshrc

jdk() {
    version=$1
    unset JAVA_HOME;
    echo "/usr/libexec/java_home -v$version";
    export JAVA_HOME=`/usr/libexec/java_home -v$version`;
    java -version
}

使い方、コマンドラインから jdk 1.8 or jdk 11

gradle でバージョンを指定する時は、 compileSdkVersion rootProject.ext.compileSdkVersion で指定したり compileSdkVersion buildConfig.compileSdk 等と指定したりしていましたが、
compileSdk build_versions.compile_sdk と言う記述を見つけました。
これからは、上記を使おうかと思います。

versions.gradle ファイル

def build_versions = [:]
build_versions.min_sdk = 14
build_versions.compile_sdk = 31
build_versions.target_sdk = 31
build_versions.build_tools = "31.0.0"
ext.build_versions = build_versions

def versions = [:]
versions.activity = '1.1.0'
versions.core_ktx = "1.1.0"
ext.versions = versions

build.gradle

buildscript { 
    apply from: 'versions.gradle' 
} 

android { 
    compileSdk build_versions.compile_sdk 
} 

dependencies { 
    implementation "androidx.core:core-ktx:${versions.core_ktx}" 
}

 

deps. までは、やらないかな

https://github.com/android/architecture-components-samples/blob/main/BasicSample/app/build.gradle

https://gist.github.com/Schadenfeude/8ed81dd06f01d6eeab571555fc8308d1

./gradlew tasks
© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha