Start using libkiwix 11.0.0 from maven, loading wrappers .so files for fixing the jni crash which we have missed loading in libkiwix

This commit is contained in:
MohitMali 2023-07-17 11:55:19 +05:30 committed by Kelson
parent a1ee8bec25
commit 161337a818
6 changed files with 23 additions and 14 deletions

View File

@ -100,9 +100,6 @@ play {
dependencies {
androidTestImplementation(Libs.leakcanary_android_instrumentation)
implementation("com.getkeepsafe.relinker:relinker:1.4.5")
api(fileTree(mapOf("include" to "*.aar", "dir" to "libs")))
implementation(files("/home/hp-pc03/Desktop/lib-release.aar"))
}
task("generateVersionCodeAndName") {
val file = File("VERSION_INFO")

View File

@ -344,4 +344,9 @@ object Libs {
* https://developer.android.com/testing
*/
const val junit: String = "androidx.test.ext:junit:" + Versions.junit
/**
* https://github.com/KeepSafe/ReLinker
*/
const val relinker: String = "com.getkeepsafe.relinker:relinker:" + Versions.relinker
}

View File

@ -86,7 +86,7 @@ object Versions {
const val core_ktx: String = "1.3.2"
const val kiwixlib: String = "10.1.1"
const val kiwixlib: String = "11.0.0"
const val material: String = "1.2.1"
@ -101,6 +101,8 @@ object Versions {
const val webkit: String = "1.3.0"
const val junit: String = "1.1.4"
const val relinker: String = "1.4.5"
}
/**

View File

@ -60,16 +60,14 @@ dependencies {
implementation(Libs.threetenabp)
// Get kiwixlib online if it is not populated locally
implementation("com.getkeepsafe.relinker:relinker:1.4.5")
api(fileTree(mapOf("include" to "*.aar", "dir" to "libs")))
implementation(files("/home/hp-pc03/Desktop/lib-release.aar"))
// if (!shouldUseLocalVersion()) {
// api(Libs.kiwixlib)
// } else {
// implementation("com.getkeepsafe.relinker:relinker:1.4.5")
// api(fileTree(mapOf("include" to "*.aar", "dir" to "libs")))
// implementation(files("/home/hp-pc03/Desktop/lib-release.aar"))
// }
if (!shouldUseLocalVersion()) {
api(Libs.kiwixlib)
} else {
api(fileTree(mapOf("include" to "*.aar", "dir" to "libs")))
}
// Relinker to load libkiwix
implementation(Libs.relinker)
// Document File
implementation(Libs.select_folder_document_file)

View File

@ -31,6 +31,7 @@
<ID>MagicNumber:Seconds.kt$Seconds$60</ID>
<ID>MagicNumber:Seconds.kt$Seconds$60.0</ID>
<ID>MagicNumber:TabsAdapter.kt$TabsAdapter$8</ID>
<ID>MagicNumber:ZimFileReader.kt$ZimFileReader$1024</ID>
<ID>MatchingDeclarationName:PageTestHelpers.kt$PageImpl : Page</ID>
<ID>MaxLineLength:BookUtilsTest.kt$BookUtilsTest$// this case uses the result from the container nested class inside LanguageUtils. It will be tested in LanguageUtilsTest</ID>
<ID>MaxLineLength:MetaLinkNetworkEntityTest.kt$MetaLinkNetworkEntityTest$"http://www.mirrorservice.org/sites/download.kiwix.org/zim/wikipedia/wikipedia_af_all_nopic_2016-05.zim"</ID>

View File

@ -19,6 +19,7 @@ package org.kiwix.kiwixmobile.core
import android.content.Context
import android.util.Log
import com.getkeepsafe.relinker.ReLinker
import org.kiwix.libkiwix.JNIKiwix
import org.kiwix.kiwixmobile.core.utils.TAG_KIWIX
import java.io.File
@ -27,6 +28,11 @@ import javax.inject.Inject
internal class JNIInitialiser @Inject constructor(context: Context, jniKiwix: JNIKiwix) {
init {
/* Load wrapper's .so files which we have missed to load in libkiwix
More information here https://github.com/kiwix/java-libkiwix/issues/39
*/
ReLinker.loadLibrary(context, "kiwix_wrapper")
ReLinker.loadLibrary(context, "zim_wrapper")
// loadICUData(context)?.let(jniKiwix::setDataDirectory)
}