6.7.0 - Alpha4 - 部分设备无法正常初始化 MLKit Google OCR 的问题 (试修) (issue #8)

This commit is contained in:
SuperMonster003
2025-07-26 15:04:27 +08:00
parent 21b6e413cc
commit 0c5d837ec6
5 changed files with 30 additions and 10 deletions

View File

@@ -209,8 +209,7 @@
<activity
android:name="org.autojs.autojs.ui.splash.SplashActivity"
android:exported="true"
android:theme="@style/AppTheme.Splash"
>
android:theme="@style/AppTheme.Splash">
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/app_shortcuts" />
@@ -748,6 +747,15 @@
android:name="moe.shizuku.client.V3_SUPPORT"
android:value="true" />
<!-- @Hint by SuperMonster003 on Jul 25, 2025. -->
<!-- ! -->
<!-- ! This provider is explicitly excluded and manually initialized in org.autojs.autojs.App. -->
<!-- ! zh-CN: 此 provider 被显式排除, 并在 org.autojs.autojs.App 手动初始化. -->
<provider
android:name="com.google.mlkit.common.internal.MlKitInitProvider"
android:authorities="${applicationId}.mlkitinitprovider"
tools:node="remove" />
</application>
</manifest>

View File

@@ -17,9 +17,11 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.CustomViewTarget
import com.bumptech.glide.request.transition.Transition
import com.flurry.android.FlurryAgent
import com.google.mlkit.common.sdkinternal.MlKitContext
import com.hjq.toast.Toaster
import com.tencent.bugly.Bugly
import com.tencent.bugly.crashreport.CrashReport
import org.autojs.autojs.apkbuilder.ApkBuilder
import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.core.pref.Pref
import org.autojs.autojs.core.ui.inflater.ImageLoader
@@ -28,6 +30,7 @@ import org.autojs.autojs.event.GlobalKeyObserver
import org.autojs.autojs.external.receiver.DynamicBroadcastReceivers
import org.autojs.autojs.leakcanary.LeakCanarySetup
import org.autojs.autojs.pluginclient.DevPluginService
import org.autojs.autojs.runtime.api.augment.ocr.Ocr
import org.autojs.autojs.timing.TimedTaskManager
import org.autojs.autojs.timing.TimedTaskScheduler
import org.autojs.autojs.tool.CrashHandler
@@ -68,6 +71,7 @@ class App : MultiDexApplication() {
setupDrawableImageLoader()
TimedTaskScheduler.init(this)
initDynamicBroadcastReceivers()
initMlKitContext()
Toaster.init(this)
setUpDefaultNightMode()
@@ -150,6 +154,11 @@ class App : MultiDexApplication() {
}
private fun initMlKitContext() {
ApkBuilder.Libs.MLKIT_OCR.ensureLibFiles(Ocr.Companion.OcrMode.MLKIT.value)
MlKitContext.initializeIfNeeded(this)
}
private fun setupDrawableImageLoader() {
Drawables.defaultImageLoader = object : ImageLoader {
override fun loadInto(imageView: ImageView, uri: Uri) {