6.7.0 - Alpha12 - 修复 APK Parser 库可能无法正常解析部分 APK 文件类型信息的问题
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.PackageManager.GET_META_DATA
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.MeasureSpec.UNSPECIFIED
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
@@ -37,6 +38,8 @@ import java.io.File
|
||||
|
||||
object ApkInfoDialogManager {
|
||||
|
||||
private const val TAG = "ApkInfoDialogManager"
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
@SuppressLint("SetTextI18n")
|
||||
@@ -179,7 +182,11 @@ object ApkInfoDialogManager {
|
||||
|
||||
private fun getApkInfo(apkFile: File): ApkInfo? = runCatching {
|
||||
ApkFile(apkFile).use { parser ->
|
||||
val meta = runCatching { parser.apkMeta }.getOrNull()
|
||||
val meta = runCatching { parser.apkMeta }
|
||||
.onFailure {
|
||||
Log.d(TAG, "Failed to parse apk meta: ${apkFile.absolutePath}", it)
|
||||
}
|
||||
.getOrNull()
|
||||
val label = meta?.label
|
||||
val packageName = meta?.packageName
|
||||
val minSdkVersion = meta?.minSdkVersion?.toIntOrNull()
|
||||
|
||||
Reference in New Issue
Block a user