Pending exception java.lang.NoClassDefFoundError: io.netty.handler.ssl.JdkAlpnSslEngine

i’m building an application using libgdx,when i have added a io.netty library to build.gradle, meo failed to build

compile group: 'io.netty', name: 'netty-all', version: '4.1.6.Final'

error:

dex2oat F 4188 139229 /Volumes/SSD/gh-moe-master-1.2.1/aosp/art/compiler/oat_writer.cc:649]Unexpected failure to resolve a method: void io.netty.handler.ssl.JdkAlpnSslEngine$1.<init>(io.netty.handler.ssl.JdkAlpnSslEngine, io.netty.handler.ssl.JdkApplicationProtocolNegotiator$ProtocolSelector)

dex2oat F 4188 139229 /Volumes/SSD/gh-moe-master-1.2.1/aosp/art/compiler/oat_writer.cc:655] java.lang.NoClassDefFoundError: io.netty.handler.ssl.JdkAlpnSslEngine$1
dex2oat F 4188 139229 /Volumes/SSD/gh-moe-master-1.2.1/aosp/art/compiler/oat_writer.cc:655] (Throwable with empty stack trace)
NATIVE BACKTRACE:
0 dex2oat 0x000000000c9aa3d7 _ZN3art7Runtime5AbortEv + 97
1 dex2oat 0x000000000c9d0205 _ZN3art10LogMessageD2Ev + 807
2 dex2oat 0x000000000c896387 _ZN3art9OatWriter22InitImageMethodVisitor11VisitMethodEmRKNS_21ClassDataItemIteratorE + 1791
3 dex2oat 0x000000000c891bb5 _ZN3art9OatWriter15VisitDexMethodsEPNS0_16DexMethodVisitorE + 287
4 dex2oat 0x000000000c891699 _ZN3art9OatWriter19InitOatCodeDexFilesEm + 187
5 dex2oat 0x000000000c890554 _ZN3art9OatWriterC2ERKNSt3__16vectorIPKNS_7DexFileENS1_9allocatorIS5_EEEEjmiPKNS_14CompilerDriverEPNS_11ImageWriterEPNS_12TimingLoggerEPNS_7SafeMapINS1_12basic_stringIcNS1_11char_traitsIcEENS6_IcEEEESN_NS1_4lessISN_EENS_17TrackingAllocatorINS1_4pairIKSN_SN_EELNS_12AllocatorTagE7EEEEE + 644
6 dex2oat 0x000000000c714507 _ZN3art7Dex2Oat13CreateOatFileEv + 427
7 dex2oat 0x000000000c706885 main + 645
8 libdyld.dylib 0x00007fff8e2f65ad start + 1

dex2oat F 4188 139229 /Volumes/SSD/gh-moe-master-1.2.1/aosp/art/runtime/runtime.cc:464]Runtime aborting…
Aborting thread:
“main” prio=5 tid=1 Runnable (still starting up)
| group="" sCount=0 dsCount=0 obj=0x0 self=0x7f7f52002600
| sysTid=139229 nice=-1 cgrp=default sched=1/31 handle=0x7fff79989000
| state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
| stack=0x7fff52cff000-0x7fff52d07000 stackSize=8MB
| held mutexes= “abort lock” “mutator lock”(shared held)
(no managed stack frames)
Pending exception java.lang.NoClassDefFoundError: io.netty.handler.ssl.JdkAlpnSslEngine$1
(Throwable with empty stack trace)Dumping all threads without appropriate locks held: thread list lock

i tried to add proguardlevel ‘all’ but that didn’t fix it

can any one help me :frowning:

Hi,

this usually happens, when your app tries to load a class with reflection. Try adding the class to proguard.append.cfg like this:

-keep class io.netty.handler.ssl.JdkAlpnSslEngine* { *; }

More information on using ProGuard can be found here.

Best Regards,
Gergely

hi, thx for replaying
that did not fix the issu, infact i changed progardlevel to ‘app’ and i added the following lines to proguard.append.config

-keep class io.netty.handler.ssl.JdkAlpnSslEngine* { *; }
-keep class io.netty.channel.sctp.SctpNotificationHandler { *; }

-keep class org.jboss.** { *; }
-keep enum org.jboss.** { *; }

-keep class sun.nio.sctp.AbstractNotificationHandler { *; }

proguard.log:

Warning: io.netty.channel.sctp.SctpNotificationHandler: can't find superclass or interface com.sun.nio.sctp.AbstractNotificationHandler
Warning: io.netty.handler.codec.marshalling.ChannelBufferByteInput: can't find superclass or interface org.jboss.marshalling.ByteInput
Warning: io.netty.handler.codec.marshalling.ChannelBufferByteOutput: can't find superclass or interface org.jboss.marshalling.ByteOutput
Warning: io.netty.handler.codec.marshalling.LimitingByteInput: can't find superclass or interface org.jboss.marshalling.ByteInput
Warning: io.netty.handler.ssl.JdkAlpnSslEngine$1: can't find superclass or interface org.eclipse.jetty.alpn.ALPN$ServerProvider
Warning: io.netty.handler.ssl.JdkAlpnSslEngine$2: can't find superclass or interface org.eclipse.jetty.alpn.ALPN$ClientProvider
Warning: io.netty.handler.ssl.JdkNpnSslEngine$1: can't find superclass or interface org.eclipse.jetty.npn.NextProtoNego$ServerProvider
Warning: io.netty.handler.ssl.JdkNpnSslEngine$2: can't find superclass or interface org.eclipse.jetty.npn.NextProtoNego$ClientProvider
Warning: io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$OpenSslCertificateRequestedCallback: can't find superclass or interface org.apache.tomcat.jni.CertificateRequestedCallback
Warning: io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier: can't find superclass or interface org.apache.tomcat.jni.CertificateVerifier
Warning: io.netty.handler.ssl.util.X509TrustManagerWrapper: can't find superclass or interface javax.net.ssl.X509ExtendedTrustManager

do you have any other suggestion?

You should check whether these missing classes are actually present in the input of ProGuard. If yes, then the ProGuard configuration has to be adjusted to keep them. If not, then the Gradle dependencies have to be adjusted.