暂存应用程序.... 解析包时出现问题
Posted
技术标签:
【中文标题】暂存应用程序.... 解析包时出现问题【英文标题】:Staging app.... There was a problem parsing the package 【发布时间】:2021-07-17 19:35:20 【问题描述】:我制作了一个应用程序Ave
,它通过我的网站下载ave.apk
包进行更新。该应用程序允许从未知来源安装。多年来一直运行良好。
更新过程在 android 4.4 和 Andoid 9 中仍然可以完美运行。但在 Android 11 中,下载新的ave.apk
后,我收到一个错误,有两个弹出窗口。下面有一个进度说:
**Unknown**
Staging app...
____________________________
祝酒词:
There was a problem parsing the package.
OK.
然而,我可以通过 Android Studio 和adb install ave.apk
正常安装ave.apk
。即使应用本身,只要我不将apk保存在应用文件夹中!
我在 Android Studio 控制台中看到此错误:
2021-04-23 11:56:15.350 3917-3971/? I/[AirCmd]_MediaControlStateMonitor: isForegroundAppSupportsMediaButton : mediaSession is empty
2021-04-23 11:56:15.350 3917-3971/? I/[AirCmd]_MediaControlStateMonitor: active Notification List is null
2021-04-23 11:56:15.350 3917-3971/? I/[AirCmd]_PenActionRule: getAction : get default action data from remote action because pen action data is null.
2021-04-23 11:56:15.350 3917-3971/? I/[AirCmd]_BleSpenButtonActionDetector: enableDoubleClickDetection: enabled=true, doubleClickWaitInterval=300
2021-04-23 11:56:15.350 3917-3971/? I/[AirCmd]_RemoteSpenMainController: onSwitch : package is com.google.android.packageinstaller and activity is com.android.packageinstaller.InstallStaging and isBleConnected is true and hasActions is false
2021-04-23 11:56:15.350 3917-3917/? I/AC:FloatingIconController: onBleFloatingIconStateChanged isEnabled : false, delay : 250
2021-04-23 11:56:15.351 2661-28003/? W/FuseDaemon: Invalid other package file access from com.floritfoto.apps.ave(: /storage/58ED-1620/Android/data/com.floritfoto.apps.ave/ornitologia/Downloads/ave.apk: Success
2021-04-23 11:56:15.352 11973-16410/? W/InstallStaging: Error staging apk from content URI
java.io.IOException: read failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.read(IoBridge.java:519)
at java.io.FileInputStream.read(FileInputStream.java:320)
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:1005)
at java.io.FileInputStream.read(FileInputStream.java:289)
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:996)
at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:184)
at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:167)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.system.ErrnoException: read failed: ENOENT (No such file or directory)
at libcore.io.Linux.readBytes(Native Method)
at libcore.io.Linux.read(Linux.java:189)
at libcore.io.ForwardingOs.read(ForwardingOs.java:176)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:305)
at libcore.io.ForwardingOs.read(ForwardingOs.java:176)
at libcore.io.IoBridge.read(IoBridge.java:509)
at java.io.FileInputStream.read(FileInputStream.java:320)
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:1005)
at java.io.FileInputStream.read(FileInputStream.java:289)
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:996)
at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:184)
at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:167)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2021-04-23 11:56:15.353 11973-11973/? I/Dialog: mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
2021-04-23 11:56:15.354 11973-11973/? I/DecorView: [INFO] isPopOver=false, config=false
2021-04-23 11:56:15.354 11973-11973/? I/DecorView: updateCaptionType >> DecorView@2e1b4ce[], isFloating=true, isApplication=true, hasWindowDecorCaption=false, hasWindowControllerCallback=false
2021-04-23 11:56:15.354 11973-11973/? D/DecorView: setCaptionType = 0, this = DecorView@2e1b4ce[]
2021-04-23 11:56:15.357 11973-11973/? D/ScrollView: initGoToTop
2021-04-23 11:56:15.358 11973-11973/? D/ScrollView: initGoToTop
所以似乎有些文件消失了??哪一个?显示两个弹出窗口后,我仍然可以做一个
ls /storage/58ED-1620/Android/data/com.floritfoto.apps.ave/ornitologia/Downloads/ave.apk
ave.apk
在那里。因此,缺少的不是ave.apk
。不幸的是,Android 没有告诉我找不到哪个文件...
这是我从文件提供程序获得的 URI:
content://com.floritfoto.apps.ave.provider/root/storage/58ED-1620/Android/data/com.floritfoto.apps.ave/ornitologia/Downloads/ave.apk
这是我的xml路径文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="external_files"
path="." />
<root-path
name="root"
path="." />
</paths>
编辑:如果我将 apk 保存到内存或 sdcard 中的任何其他位置,我可以更新。所以这是与应用文件夹有关的东西。
【问题讨论】:
您是否检查过范围存储概念。访问内部文件夹有限制。 我的应用面向 API29。无论如何,该文件位于外部 SDCard 的 app 文件夹中。这会带来问题吗? 【参考方案1】:似乎在 Android 11 中,我们无法通过 FileProvider
共享外部可移动微型 sdcard 存储中的应用程序自己的文件:提供程序路径 .xml 文件中的技巧 <root-path name="root" path="." />
不再适用于自己的应用程序文件夹。然而,它仍然适用于可移动存储中的其他文件夹(除了 Android/data 和 Android/obb 中的文件夹)。如果您认为这是无稽之谈,那就怪 Google。
所以我胆小的解决方案是将.apk 下载到公共Download
文件夹Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
,然后从那里安装。这当然行得通。
【讨论】:
以上是关于暂存应用程序.... 解析包时出现问题的主要内容,如果未能解决你的问题,请参考以下文章