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