Exception with netty

Hi,

I am getting this error when I am trying to build my project:

dex2oat F 10387 456025 /Users/rolandvigh/public-repo/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=0x7fb704000000
  | sysTid=456025 nice=-1 cgrp=default sched=1/31 handle=0x7fffc75ea3c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff53367000-0x7fff5336f000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)
Pending exception java.lang.NoClassDefFoundError: io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAllocatorAdapter
(Throwable with empty stack trace)Dumping all threads without appropriate locks held: thread list lock
All threads:
DALVIK THREADS (1):
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 dsCount=0 obj=0x0 self=0x7fb704000000
  | sysTid=456025 nice=-1 cgrp=default sched=1/31 handle=0x7fffc75ea3c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff53367000-0x7fff5336f000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)

dex2oat W 10387 456025 /Users/rolandvigh/public-repo/aosp/art/runtime/barrier.cc:96] Attempted to destroy barrier with non zero count -1

What could be the problem?

Thanks.

Check the proguard logs if io.netty.* packages wasn’t removed and add exclusions as needed.

The content of my proguard file:

-keep class **
-dontwarn **

Hi!

Please try add this line to proguard.append.cfg:
-keep class io.netty.** { *; }

Best Regards,
Roland

This has been the output:

dex2oat F 6951 455642 /Users/rolandvigh/public-repo/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=0x7fb980809800
  | sysTid=455642 nice=-1 cgrp=default sched=1/31 handle=0x7fffde03d3c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff5c608000-0x7fff5c610000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)
Pending exception java.lang.NoClassDefFoundError: io.netty.handler.codec.marshalling.ChannelBufferByteInput
(Throwable with empty stack trace)Dumping all threads without appropriate locks held: thread list lock
All threads:
DALVIK THREADS (1):
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 dsCount=0 obj=0x0 self=0x7fb980809800
  | sysTid=455642 nice=-1 cgrp=default sched=1/31 handle=0x7fffde03d3c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff5c608000-0x7fff5c610000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)

dex2oat W  6951 455642 /Users/rolandvigh/public-repo/aosp/art/runtime/barrier.cc:96] Attempted to destroy barrier with non zero count -1

My proguard file:

-keep class io.netty.** { *; }
-dontwarn **

Hi!

Can you provide us with a test project to reproduce this?

Best Regards,
Roland

Is your proguard file proguard.append.cfg or proguard.cfg ? They behave very differently.

I second what Roland wrote: a test project would be the easiest way for us to help.

Here is my project,

thanks.

MoeApp.zip (3.6 MB)

Hi!

Xcode project seems to be corrupt, we cannot open it in Xcode 9.2. How did you create it?

Best Regards,
Roland

Try with this

MoeApp.zip (3.6 MB)

Hi,

any idea about the error?

Hi!

Could you please try this in your build.gradle? It basically removes the problematic classes from the ProGuard output. The reason is, that netty includes classes that are not expected to be used on Android, and regular Android does not have an issue with this. However, on MOE we require that only fully resolved classes are passed to the dex2oat step (the step that compiles from DEX bytecode to machine code).

moeMainProGuard {
        doLast {
            def jar = getOutJar()
            def outputDir = file(jar.getAbsolutePath() + "_")
            copy{
                from(zipTree(jar)){
                    exclude "io/netty/handler/ssl/Java9SslEngine*"
                    exclude "io/netty/handler/ssl/Java9SslUtils*"
                    exclude "io/netty/handler/ssl/JettyAlpnSslEngine*"
                    exclude "io/netty/handler/ssl/JettyNpnSslEngine*"
                    exclude "io/netty/handler/ssl/ReferenceCountedOpenSslContext*"
                    exclude "io/netty/handler/ssl/OpenSslContext*"
                    exclude "io/netty/handler/ssl/OpenSslClientContext*"
                    exclude "io/netty/handler/ssl/OpenSslServerContext*"
                    exclude "io/netty/handler/ssl/ReferenceCountedOpenSslClientContext*"
                    exclude "io/netty/handler/ssl/ReferenceCountedOpenSslServerContext*"
                    exclude "io/netty/handler/ssl/ConscryptAlpnSslEngine*"
                    exclude "io/netty/handler/ssl/util/X509TrustManagerWrapper*"
                    exclude "io/netty/util/internal/LongAdderCounter*"
                }
                into outputDir
            }
            delete jar
            ant.jar(update: "true", index: "true", destfile: jar.getAbsolutePath()) {
                fileset(dir: outputDir)
            }
            delete outputDir
        }
    }

Best Regards,
Roland