mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 10:56:50 -04:00
Merge pull request #1313 from kiwix/feature/macgills/#1259-unsatisfied-link-error
#1259 Crash Report: UnsatisfiedLinkError - integrate with changes to…
This commit is contained in:
commit
b1530a2777
@ -58,6 +58,8 @@ If you wish to rebase you should be following the [Golden Rule](https://www.atla
|
|||||||
|
|
||||||
The default build is `debug`, with this variant you can use a debugger while developing. To install the application click the `run` button in Android Studio with the `app` configuration selected while you have a device connected. All other build types but `release` can be ignored, the `release` build is what gets uploaded to the Google Play store and can be built locally with the dummy credentials/keystore provided.
|
The default build is `debug`, with this variant you can use a debugger while developing. To install the application click the `run` button in Android Studio with the `app` configuration selected while you have a device connected. All other build types but `release` can be ignored, the `release` build is what gets uploaded to the Google Play store and can be built locally with the dummy credentials/keystore provided.
|
||||||
|
|
||||||
|
By default we fetch kiwix-lib, the key component for interacting with ZIM files from maven, but if you wish to use your own locally compiled version for testing purposes, then you can create the directory `app/libs` and place your .aar file inside it to have it used instead.
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Unit tests are located in `app/src/test` and to run them locally you
|
Unit tests are located in `app/src/test` and to run them locally you
|
||||||
|
@ -50,12 +50,13 @@ String[] archs = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
|
|||||||
dependencies {
|
dependencies {
|
||||||
// use jdk8 java.time backport, as long app < Build.VERSION_CODES.O
|
// use jdk8 java.time backport, as long app < Build.VERSION_CODES.O
|
||||||
implementation("com.jakewharton.threetenabp:threetenabp:1.1.1")
|
implementation("com.jakewharton.threetenabp:threetenabp:1.1.1")
|
||||||
|
|
||||||
// Get kiwixlib online if it is not populated locally
|
// Get kiwixlib online if it is not populated locally
|
||||||
if (file("../kiwixlib/src/main").list().length == 1) {
|
if (!shouldUseLocalVersion()) {
|
||||||
implementation 'org.kiwix.kiwixlib:kiwixlib:1.0.12'
|
implementation 'org.kiwix.kiwixlib:kiwixlib:6.0.2'
|
||||||
} else {
|
} else {
|
||||||
implementation project(":kiwixlib")
|
implementation 'com.getkeepsafe.relinker:relinker:1.3.1'
|
||||||
archs = file("../kiwixlib/src/main/jniLibs").list()
|
implementation fileTree(include: ['*.aar'], dir: 'libs')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android Support
|
// Android Support
|
||||||
@ -146,6 +147,10 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldUseLocalVersion() {
|
||||||
|
file("./libs").exists()
|
||||||
|
}
|
||||||
|
|
||||||
// Set custom app import directory
|
// Set custom app import directory
|
||||||
def map = [:]
|
def map = [:]
|
||||||
def custom = new File("app/src")
|
def custom = new File("app/src")
|
||||||
|
@ -125,7 +125,7 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
*
|
*
|
||||||
* Note that the value returned is NOT unique for each zim file. Versions of the same wiki
|
* Note that the value returned is NOT unique for each zim file. Versions of the same wiki
|
||||||
* (complete, nopic, novid, etc) may return the same title.
|
* (complete, nopic, novid, etc) may return the same title.
|
||||||
* */
|
*/
|
||||||
public static String getZimFileTitle() {
|
public static String getZimFileTitle() {
|
||||||
if (currentJNIReader == null || zimFileName == null) {
|
if (currentJNIReader == null || zimFileName == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -409,10 +409,8 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
String fileName = uri.toString();
|
String fileName = uri.toString();
|
||||||
fileName = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());
|
fileName = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());
|
||||||
File f = new File(FileUtils.getFileCacheDir(getContext()), fileName);
|
File f = new File(FileUtils.getFileCacheDir(getContext()), fileName);
|
||||||
JNIKiwixString mime = new JNIKiwixString();
|
byte[] data = currentJNIReader.getContent(new JNIKiwixString(filePath), new JNIKiwixString(),
|
||||||
JNIKiwixString title = new JNIKiwixString();
|
new JNIKiwixString(), new JNIKiwixInt());
|
||||||
JNIKiwixInt size = new JNIKiwixInt();
|
|
||||||
byte[] data = currentJNIReader.getContent(filePath, title, mime, size);
|
|
||||||
FileOutputStream out = new FileOutputStream(f);
|
FileOutputStream out = new FileOutputStream(f);
|
||||||
out.write(data, 0, data.length);
|
out.write(data, 0, data.length);
|
||||||
out.flush();
|
out.flush();
|
||||||
@ -473,10 +471,10 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
JNIKiwixString mime = new JNIKiwixString();
|
final JNIKiwixString mime = new JNIKiwixString();
|
||||||
JNIKiwixString title = new JNIKiwixString();
|
final JNIKiwixInt size = new JNIKiwixInt();
|
||||||
JNIKiwixInt size = new JNIKiwixInt();
|
final JNIKiwixString url = new JNIKiwixString(this.articleZimUrl);
|
||||||
byte[] data = currentJNIReader.getContent(articleZimUrl, title, mime, size);
|
byte[] data = currentJNIReader.getContent(url, new JNIKiwixString(), mime, size);
|
||||||
if (mime.value != null && mime.value.equals("text/css") && MainActivity.nightMode) {
|
if (mime.value != null && mime.value.equals("text/css") && MainActivity.nightMode) {
|
||||||
out.write(("img, video { \n" +
|
out.write(("img, video { \n" +
|
||||||
" -webkit-filter: invert(1); \n" +
|
" -webkit-filter: invert(1); \n" +
|
||||||
@ -486,7 +484,7 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
out.write(data, 0, data.length);
|
out.write(data, 0, data.length);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
Log.d(TAG_KIWIX, "reading " + articleZimUrl
|
Log.d(TAG_KIWIX, "reading " + url.value
|
||||||
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
||||||
} catch (IOException | NullPointerException e) {
|
} catch (IOException | NullPointerException e) {
|
||||||
Log.e(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
|
Log.e(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.di.modules;
|
package org.kiwix.kiwixmobile.di.modules;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@ -29,7 +30,7 @@ import org.kiwix.kiwixlib.JNIKiwix;
|
|||||||
@Module public class JNIModule {
|
@Module public class JNIModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public JNIKiwix providesJNIKiwix() {
|
public JNIKiwix providesJNIKiwix(Context context) {
|
||||||
return new JNIKiwix();
|
return new JNIKiwix(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 28
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 15
|
|
||||||
targetSdkVersion 28
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion")
|
|
||||||
testImplementation "junit:junit:$jUnitVersion"
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
<manifest package="kiwix.org.kiwixlib">
|
|
||||||
|
|
||||||
<application>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
Loading…
x
Reference in New Issue
Block a user