pull/1301/head
ag2s20150909 3 years ago
parent 855963b92a
commit 327b514951
  1. 10
      app/build.gradle
  2. BIN
      app/cronetlib/cronet_api.jar
  3. BIN
      app/cronetlib/cronet_impl_common_java.jar
  4. BIN
      app/cronetlib/cronet_impl_native_java.jar
  5. 2
      app/src/main/assets/cronet.json
  6. 2
      app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt
  7. 6
      app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt
  8. 2
      app/src/main/java/io/legado/app/help/http/cronet/CronetUrlRequestCallback.kt
  9. 2
      gradle.properties

@ -129,6 +129,8 @@ dependencies {
implementation('androidx.multidex:multidex:2.0.1') implementation('androidx.multidex:multidex:2.0.1')
//kotlin //kotlin
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
//Kotlin反射
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// //
def coroutines_version = '1.5.1' def coroutines_version = '1.5.1'
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
@ -137,19 +139,19 @@ dependencies {
//androidX //androidX
implementation('androidx.appcompat:appcompat:1.3.1') implementation('androidx.appcompat:appcompat:1.3.1')
implementation('androidx.core:core-ktx:1.6.0') implementation('androidx.core:core-ktx:1.6.0')
implementation("androidx.activity:activity-ktx:1.3.0") implementation("androidx.activity:activity-ktx:1.3.1")
implementation("androidx.fragment:fragment-ktx:1.3.6") implementation("androidx.fragment:fragment-ktx:1.3.6")
implementation('androidx.preference:preference-ktx:1.1.1') implementation('androidx.preference:preference-ktx:1.1.1')
implementation('androidx.constraintlayout:constraintlayout:2.0.4') implementation('androidx.constraintlayout:constraintlayout:2.1.0')
implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0') implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0')
implementation('androidx.viewpager2:viewpager2:1.0.0') implementation('androidx.viewpager2:viewpager2:1.0.0')
implementation('com.google.android.material:material:1.4.0') implementation('com.google.android.material:material:1.4.0')
implementation('com.google.android.flexbox:flexbox:3.0.0') implementation('com.google.android.flexbox:flexbox:3.0.0')
implementation('com.google.code.gson:gson:2.8.7') implementation('com.google.code.gson:gson:2.8.8')
implementation('androidx.webkit:webkit:1.4.0') implementation('androidx.webkit:webkit:1.4.0')
//media //media
implementation("androidx.media:media:1.4.0") implementation("androidx.media:media:1.4.1")
def exoplayer_version = '2.15.0' def exoplayer_version = '2.15.0'
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version" implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer_version" implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer_version"

Binary file not shown.

@ -1 +1 @@
{"arm64-v8a":"1f4e088f6e00175e12ee153e4004d283","armeabi-v7a":"a6726219c9a6217b95763baa3d61eb18","x86":"73b6a220fe16e0cdeebf1094980825c2","x86_64":"12fd5bb0a12664294b64fffccd326347","version":"92.0.4515.159"} {"arm64-v8a":"18441011d4a2e3751b8152ad05ab24da","armeabi-v7a":"701930e54c2cfa3d6d0df37168ecc4a6","x86":"3d4ebb7f23b910a8b50a2966eb39bbe7","x86_64":"9be68a8e03867c8f844e8eec88fe09ed","version":"93.0.4577.62"}

@ -28,7 +28,7 @@ class CronetInterceptor(private val cookieJar: CookieJar?) : Interceptor {
response response
} catch (e: Exception) { } catch (e: Exception) {
//遇到Cronet处理有问题时的情况,如证书过期等等,回退到okhttp处理 //遇到Cronet处理有问题时的情况,如证书过期等等,回退到okhttp处理
if (e.message.toString().contains("ERR_CERT_", true)) { if (e.message.toString().contains("ERR_CERT_", true)||e.message.toString().contains("ERR_SSL_",true)) {
chain.proceed(original) chain.proceed(original)
} else { } else {
throw e throw e

@ -22,8 +22,8 @@ import java.util.*
object CronetLoader : CronetEngine.Builder.LibraryLoader() { object CronetLoader : CronetEngine.Builder.LibraryLoader() {
//https://storage.googleapis.com/chromium-cronet/android/92.0.4515.127/Release/cronet/libs/arm64-v8a/libcronet.92.0.4515.159.so //https://storage.googleapis.com/chromium-cronet/android/92.0.4515.159/Release/cronet/libs/arm64-v8a/libcronet.92.0.4515.159.so
//https://cdn.jsdelivr.net/gh/ag2s20150909/cronet-repo@92.0.4515.127/cronet/92.0.4515.127/arm64-v8a/libcronet.92.0.4515.159.so.js //https://cdn.jsdelivr.net/gh/ag2s20150909/cronet-repo@92.0.4515.159/cronet/92.0.4515.127/arm64-v8a/libcronet.92.0.4515.159.so.js
private const val TAG = "CronetLoader" private const val TAG = "CronetLoader"
private const val soVersion = BuildConfig.Cronet_Version private const val soVersion = BuildConfig.Cronet_Version
private const val soName = "libcronet.$soVersion.so" private const val soName = "libcronet.$soVersion.so"
@ -161,7 +161,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
val appInfo = context.applicationInfo val appInfo = context.applicationInfo
val abiField = ApplicationInfo::class.java.getDeclaredField("primaryCpuAbi") val abiField = ApplicationInfo::class.java.getDeclaredField("primaryCpuAbi")
abiField.isAccessible = true abiField.isAccessible = true
cpuAbi = abiField[appInfo] as String cpuAbi = abiField.get(appInfo) as String?
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }

@ -140,8 +140,6 @@ class CronetUrlRequestCallback @JvmOverloads internal constructor(
mResponseCondition.open() mResponseCondition.open()
this.eventListener?.callFailed(mCall, e) this.eventListener?.callFailed(mCall, e)
responseCallback?.onFailure(mCall, e) responseCallback?.onFailure(mCall, e)
} }

@ -22,4 +22,4 @@ kotlin.code.style=official
android.enableResourceOptimizations=true android.enableResourceOptimizations=true
CronetVersion=92.0.4515.159 CronetVersion=93.0.4577.62

Loading…
Cancel
Save