mirror of https://github.com/NekoX-Dev/NekoX.git
Fix native lib load
This commit is contained in:
parent
88cd325e8c
commit
688ffc3bba
|
@ -111,6 +111,7 @@
|
|||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/NekoX"
|
||||
android:largeHeap="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:manageSpaceActivity="org.telegram.ui.ExternalActionActivity"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
|
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.io.resource.ResourceUtil
|
|||
import org.telegram.messenger.ApplicationLoader
|
||||
import org.telegram.messenger.FileLog
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
object FileUtil {
|
||||
|
@ -33,7 +32,7 @@ object FileUtil {
|
|||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun delete(file: File?,filter: (File) -> Boolean = { true }) {
|
||||
fun delete(file: File?, filter: (File) -> Boolean = { true }) {
|
||||
|
||||
runCatching {
|
||||
|
||||
|
@ -155,40 +154,30 @@ object FileUtil {
|
|||
|
||||
if (!execFile.isFile) {
|
||||
|
||||
System.loadLibrary(name)
|
||||
FileLog.d("Native library $execFile not found")
|
||||
|
||||
execFile = File(ApplicationLoader.getDataDirFixed(), "cache/lib/${execFile.name}")
|
||||
|
||||
if (!execFile.isFile) {
|
||||
|
||||
FileLog.d("Native library $execFile not found")
|
||||
runCatching {
|
||||
|
||||
execFile = File(ApplicationLoader.getDataDirFixed(), "cache/lib/${execFile.name}")
|
||||
saveNonAsset("lib/${Build.CPU_ABI}/${execFile.name}", execFile)
|
||||
|
||||
if (!execFile.isFile) {
|
||||
FileLog.d("lib extracted with default abi: $execFile, ${Build.CPU_ABI}")
|
||||
|
||||
runCatching {
|
||||
}.recover {
|
||||
|
||||
saveNonAsset("lib/${Build.CPU_ABI}/${execFile.name}", execFile)
|
||||
saveNonAsset("lib/${Build.CPU_ABI2}/${execFile.name}", execFile)
|
||||
|
||||
FileLog.d("lib extracted with default abi: $execFile, ${Build.CPU_ABI}")
|
||||
FileLog.d("lib extracted with abi2: $execFile, ${Build.CPU_ABI2}")
|
||||
|
||||
}.recover {
|
||||
|
||||
saveNonAsset("lib/${Build.CPU_ABI2}/${execFile.name}", execFile)
|
||||
|
||||
FileLog.d("lib extracted with abi2: $execFile, ${Build.CPU_ABI2}")
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
FileLog.d("lib already extracted: $name")
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
FileLog.d("lib found after load: $name")
|
||||
FileLog.d("lib already extracted: $name")
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
|
||||
|
|
|
@ -20,3 +20,4 @@ org.gradle.configureondemand=false
|
|||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx4096M" -XX\:MaxPermSize\=4096m
|
||||
org.gradle.parallel=true
|
||||
android.bundle.enableUncompressedNativeLibs=false
|
Loading…
Reference in New Issue