1.在Android Studio中需要导入jar包
maven下载地址,包括所有netty 版本:https://mvnrepository.com/artifact/io.netty/netty-all
4.0.15: http://central.maven.org/maven2/io/netty/netty-all/4.0.15.Final/
git 源码地址:https://github.com/netty/netty/tree/netty-4.0.14.Final
jar下载地址:http://netty.io/downloads.html
2. gradle可以通过解析implementation的地址来获得正确的jar地址,在底层的gradle里修改为
buildscript {
repositories {
google()
jcenter()
maven{ url 'http://central.maven.org/maven2/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
并且在app/gradle里添加
implementation group: 'io.netty', name: 'netty-all', version: '4.1.31.Final'
再次sync同步,ok,正确无报错。
在程序里import一下
import io.netty.
建议使用第二种方式简单便捷.