|
|
|
@ -27,19 +27,16 @@ val cronetEngine: ExperimentalCronetEngine by lazy { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val builder = ExperimentalCronetEngine.Builder(appCtx).apply { |
|
|
|
|
if (!AppConfig.isGooglePlay) { |
|
|
|
|
if (!AppConfig.isGooglePlay&&CronetLoader.install()) { |
|
|
|
|
setLibraryLoader(CronetLoader)//设置自定义so库加载 |
|
|
|
|
} |
|
|
|
|
setStoragePath(appCtx.externalCacheDir?.absolutePath)//设置缓存路径 |
|
|
|
|
enableHttpCache(HTTP_CACHE_DISK, (1024 * 1024 * 50))//设置缓存模式 |
|
|
|
|
enableHttpCache(HTTP_CACHE_DISK, (1024 * 1024 * 50).toLong())//设置缓存模式 |
|
|
|
|
enableQuic(true)//设置支持http/3 |
|
|
|
|
enableHttp2(true) //设置支持http/2 |
|
|
|
|
enablePublicKeyPinningBypassForLocalTrustAnchors(true) |
|
|
|
|
//enableNetworkQualityEstimator(true) |
|
|
|
|
|
|
|
|
|
//Brotli压缩 |
|
|
|
|
enableBrotli(true) |
|
|
|
|
//setExperimentalOptions("{\"quic_version\": \"h3-29\"}") |
|
|
|
|
enableBrotli(true)//Brotli压缩 |
|
|
|
|
} |
|
|
|
|
val engine = builder.build() |
|
|
|
|
Log.d("Cronet", "Cronet Version:" + engine.versionString) |
|
|
|
|