android – 创建imagefile时出错(只读文件系统)

首先,这不是重复的问题,我尝试过其他类似线程的解决方案,但看起来这种情况有所不同.

在我的情况下,我可以从同一个模拟器成功安装和运行其他Android项目(x86也尝试了arm),但是这个特定的应用程序项目在从shell内部手动“adb install”安装时也会抛出以下错误.

找到以下日志中的错误之一(行号232)
https://android.googlesource.com/platform/system/vold/+/froyo/Loop.cpp

但是我不知道错误“No content provider …”是否与同一个错误堆栈有关.

如果它有写入权限错误(sdcard或类似的文件系统权限),那么其他应用程序也应该不安装!

这个有问题的应用程序是一个NDK项目与自定义内容提供程序,我试图省略但无济于事.看起来内容提供程序错误与来自os的apk安装有关,而不是真正的应用程序内容提供程序.

我厌倦了使用真实设备进行测试,我担心这会降低我的手机寿命,因为我必须经常这样做.

--------- beginning of /dev/log/main
D/AndroidRuntime( 1977): 
D/AndroidRuntime( 1977): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker  ( 1977): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 1977): CheckJNI is ON
D/dalvikvm( 1977): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 1977): Added shared lib libjavacore.so 0x0
D/dalvikvm( 1977): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 1977): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 1977): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 1977): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 1977): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 1977): failed to load memtrack module: -2
D/AndroidRuntime( 1977): Calling main entry com.android.commands.pm.Pm
E/PackageHelper( 1680): Failed to create secure container smdl2tmp1
--------- beginning of /dev/log/system
W/ActivityManager( 1149): No content provider found for permission revoke: file:///data/local/tmp/myapp.apk
E/Vold    (  932): Error creating imagefile (Read-only file system)
E/Vold    (  932): ASEC image file creation failed (Read-only file system)
W/Vold    (  932): Returning OperationFailed - no handler for errno 30
E/DefContainer( 1680): Failed to create container smdl2tmp1
W/ActivityManager( 1149): No content provider found for permission revoke: file:///data/local/tmp/myapp.apk
D/dalvikvm( 1149): GC_EXPLICIT freed 161K, 22% free 5442K/6948K, paused 1ms+1ms, total 8ms
D/AndroidRuntime( 1977): Shutting down VM
问题可能来自:

> Android AOSP错误或您正在使用的ROM中的错误
(配置错误)
>某些东西导致存储SD卡(或模拟内部卡)上安装的应用程序的分区,只读

“出于平台安全目的,SD卡上的应用程序存储在加密容器中 – 这样其他应用程序就无法修改或损坏它们.安装SD卡时,这些容器的安装方式使得它们可以像应用程序一样访问存储在内部存储器中.“

在你的堆栈跟踪上问题是这样的:

E/Vold ( 932): Error creating imagefile (Read-only file system)
E/Vold ( 932): ASEC image file creation failed (Read-only file
system)

对于在AndroidManifest.xml中定义了android:installLocation =“preferExternal”的应用程序,我遇到了类似的问题,以下内容对我有用(彼此独立完成):

I/qtaguid ( 6299): Failed write_ctrl(u 40) res=-1 errno=22
I/qtaguid ( 6299): Untagging socket 40 failed errno=-22
W/NetworkManagementSocketTagger( 6299): untagSocket(40) failed with errno -22
D/Finsky  ( 6299): [1] 2.onResponse: Verification id=29 response=0
D/Finsky  ( 6299): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 29
E/Vold    (  127): Error creating imagefile (Read-only file system)
E/Vold    (  127): ASEC image file creation failed (Read-only file system)
W/Vold    (  127): Returning OperationFailed - no handler for errno 30
E/PackageHelper( 6280): Failed to create secure container smdl733025106.tmp
W/DefContainer( 6280): Failed to copy package at /storage/emulated/0/myapp.apk
W/DefContainer( 6280): java.io.IOException: Failed to create container smdl733025106.tmp
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService.copyPackageToContainerInner(DefaultContainerService.java:327)
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService.access$000(DefaultContainerService.java:67)
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService$1.copyPackageToContainer(DefaultContainerService.java:108)
W/DefContainer( 6280):  at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:60)
W/DefContainer( 6280):  at android.os.Binder.execTransact(Binder.java:446)

>根据https://developer.android.com/guide/topics/data/install-location.html更改为android:installLocation =“auto”
>根据http://forum.xda-developers.com/showpost.php?p=58409922&postcount=4845如果要将其安装到“内部设备存储”,无论清单显示什么或系统决定什么.

Go to Settings > Apps > Open the menu > Preferred install location >
set it to “Internal device storage”. I had this set to “Let the system
decide”. This caused some of the APKs to fail the install, because
they were marked to prefer the SD card as their installation location
and thus they tried to install onto the SD and it just failed. Now
that everything installs on the device, it works just fine.

>如果要将其安装到“外部存储”

adb root
adb shell
mount -o rw,remount rootfs /
chmod 777 /mnt/sdcard
pm install /mnt/sdcard/myapp.apk
mount -o ro,remount rootfs /

>按照https://code.google.com/p/android/issues/detail?id=9593
&安培;&安培; http://www.androidpolice.com/2011/04/19/fixing-the-couldnt-install-on-usb-storage-or-sd-card-problem-on-android/
仅当您能够在以下路径中找到smdl2tmp1.asec时
或者你得到错误

smdl2tmp1 03-24 18:48:38.784:ERROR / Vold(86):ASEC文件’/mnt/secure/asec/smdl2tmp1.asec’目前存在 – 先破坏它! (地址已在使用中)

adb root
adb shell rm /sdcard/.android_secure/smdl2tmp1.asec
adb shell rm /mnt/secure/asec/smdl2tmp1.asec

https://stackoverflow.com/questions/30276876/error-creating-imagefile-read-only-file-system

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:android – 创建imagefile时出错(只读文件系统)