暂存应用程序.... 解析包时出现问题 [英] Staging app.... There was a problem parsing the package

查看:37
本文介绍了暂存应用程序.... 解析包时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个应用 Ave,它通过我的网站下载 ave.apk 包进行更新.该应用程序允许从未知来源安装.多年来,它一直运行良好.

I made an app Ave that updates through my website downloading a ave.apk package. Install from unknown sources is allowed for the app. It has been working great for years.

更新过程在 Android 4.4 和 Andoid 9 中仍然可以完美运行.但在 Android 11 中,在下载新的 ave.apk 后,我收到一个错误,并有两个弹出窗口.下面有一个进度条:

The update process still work perfectly in Android 4.4 and Andoid 9. But in Android 11, after downloading the new ave.apk, I get an error, with two popups. One below with a progress saying:

**Unknown**
Staging app...
____________________________

并为它干杯说:

   There was a problem parsing the package.

                    OK.

但是,我可以通过 Android Studio 和 adb install ave.apk 正常安装 ave.apk.即使是应用本身,只要我不将apk保存在应用文件夹中即可!

Yet, I can install the ave.apk normally through Android Studio and also by adb install ave.apk. Even with the app itself, as long as I don't save the apk in the app folder!

我在 Android Studio 控制台中看到此错误:

I see this error in Android Studio console:

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

所以好像有些文件消失了??哪一个?显示两个弹出窗口后,我仍然可以执行

So it seems some file has vanished?? Which one? With the two popups being shown, I can still do a

ls /storage/58ED-1620/Android/data/com.floritfoto.apps.ave/ornitologia/Downloads/ave.apk

ave.apk 就在那里.因此,丢失的不是 ave.apk.不幸的是,Android 没有告诉我找不到哪个文件...

and ave.apk is there. So it is not the ave.apk that is missing. Unfortunately, Android does not tell me WHICH file is not found...

这是我从文件提供者那里得到的 URI:

This is the URI that I get from the file provider:

content://com.floritfoto.apps.ave.provider/root/storage/58ED-1620/Android/data/com.floritfoto.apps.ave/ornitologia/Downloads/ave.apk

这是我的xml路径文件的内容:

This is the content of my xml path file:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="external_files"
        path="." />
    <root-path
        name="root"
        path="." />
</paths>

如果我将 apk 保存到内部存储器或 SD 卡中的任何其他位置,我可以更新.所以这与应用程序文件夹有关.

If I save the apk into the internal memory, or anywhere else in the sdcard, I can update. So this is something related to the app folder.

推荐答案

似乎在 Android 11 中我们无法通过 FileProvider 共享外部可移动 micro sdcard 存储中应用程序自己的文件中的文件:技巧 中的提供程序路径 .xml 文件不再适用于自己的应用程序文件夹.但是,它仍然适用于可移动存储中的其他文件夹(除了 Android/data 和 Android/obb 中的文件夹).如果您认为这是无稽之谈,那就怪 Google.

It seems that in Android 11 we cannot share files from the app own files in the external removable micro sdcard storage through FileProvider: the trick <root-path name="root" path="." /> in the provider paths .xml file does not work anymore for the own app folder. Yet, it still works for the other folders in the removable storage (besides the ones in Android/data and Android/obb). If you think this is nonsense, blame Google.

所以我的懦夫解决方案是将 .apk 下载到公共 Download 文件夹 Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) 中,然后从那里安装.这当然有效.

So my coward solution was to download the .apk into the public Download folder Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), and install from there. Of course this works.

这篇关于暂存应用程序.... 解析包时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆