简体   繁体   English

在Galaxy S3上安装我编写的应用程序时出错

[英]Error while installing application written by me on Galaxy S3

When I try to launch apk file on my S3, LogCat in Eclipse shows me those errors: 当我尝试在S3上启动apk文件时,Eclipse中的LogCat向我显示了这些错误:


09-28 16:56:59.020: A/Environment(1967): Static storage paths aren't available from AID_SYSTEM
09-28 16:56:59.020: A/Environment(1967): java.lang.Throwable
09-28 16:56:59.020: A/Environment(1967):    at android.os.Environment.throwIfSystem(Environment.java)
09-28 16:56:59.020: A/Environment(1967):    at android.os.Environment.getExternalStorageDirectory(Environment.java)
09-28 16:56:59.020: A/Environment(1967):    at com.samsung.android.MtpApplication.MtpReceiver.onReceive(MtpReceiver.java)
09-28 16:56:59.020: A/Environment(1967):    at android.app.ActivityThread.handleReceiver(ActivityThread.java)
09-28 16:56:59.020: A/Environment(1967):    at android.app.ActivityThread.access$1600(ActivityThread.java)
09-28 16:56:59.020: A/Environment(1967):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
09-28 16:56:59.020: A/Environment(1967):    at android.os.Handler.dispatchMessage(Handler.java)
09-28 16:56:59.020: A/Environment(1967):    at android.os.Looper.loop(Looper.java)
09-28 16:56:59.020: A/Environment(1967):    at android.app.ActivityThread.main(ActivityThread.java)
09-28 16:56:59.020: A/Environment(1967):    at java.lang.reflect.Method.invokeNative(Native Method)
09-28 16:56:59.020: A/Environment(1967):    at java.lang.reflect.Method.invoke(Method.java)
09-28 16:56:59.020: A/Environment(1967):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
09-28 16:56:59.020: A/Environment(1967):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
09-28 16:56:59.020: A/Environment(1967):    at dalvik.system.NativeStart.main(Native Method)

Can someone help me? 有人能帮我吗?

This error only occurs on Android 4.2.2, android.os.Environment: 仅在Android 4.2.2 android.os.Environment上发生此错误:

private static void throwIfSystem()
{
    if (Process.myUid() == Process.SYSTEM_UID)
    {
        Log.wtf(TAG,
                "Static storage paths aren't available from AID_SYSTEM",
                new Throwable());
    }
}

public static File getExternalStorageDirectory()
{
    throwIfSystem();
    return sCurrentUser.getExternalStorageDirectory();
}

I have developed an app that need the system permission,so I must declare android:sharedUserId="android.uid.system" in AndroidManifest.xml and signed my application with the platform.x509.pem, platform.pk8 of the related ROM,and then I write to the external storage,the error happens. 我已经开发了一个需要系统许可的应用程序,因此必须在AndroidManifest.xml中声明android:sharedUserId =“ android.uid.system”,并使用相关ROM的platform.x509.pem,platform.pk8进行签名,然后我写到外部存储器,发生错误。

But I'm confused that maybe you run your application signed with the platform.x509.pem, platform.pk8 file of the Galaxy S3 ? 但是我感到困惑的是,也许您运行的是使用Galaxy S3的platform.x509.pem和platform.pk8文件签名的应用程序?

Because my app only run in the customized android pad with Android 4.2.2 ,so the Android framework engineer remove the throwIfSystem() method and modify the SD card write permission of my app. 由于我的应用程序只能在带有Android 4.2.2的自定义android pad中运行,因此Android框架工程师删除了throwIfSystem()方法并修改了我应用程序的SD卡写入权限。

// Android Simulator // Android模拟器

d---rwxr-x system sdcard_rw 1970-01-01 00:00 sdcard d --- rwxr-x系统sdcard_rw 1970-01-01 00:00 sdcard

// Android Customized Pad // Android定制垫

drwxrwxr-x system sdcard_rw 2014-09-01 19:07 sdcard drwxrwxr-x系统sdcard_rw 2014-09-01 19:07 sdcard

NOTE:except Android 4.2.2 ,the other Android version (except Android 4.4.2),don't have the error above,but like the same situation of my app.the offical Android system will not permit that the app with declaration of android:sharedUserId="android.uid.system" in AndroidManifest.xml and signed with the platform.x509.pem, platform.pk8 of the related ROM write into the SD card.the system will remind you permission denied.Maybe this is one security mechanism of the Android system.But when I test my app on Android official simulator on Android 4.4.2, it runs OK, I don't know why. 注意:除Android 4.2.2以外,其他Android版本(除Android 4.4.2之外)都没有上述错误,但与我的应用程序的情况相同。正式的Android系统不允许使用带有以下声明的应用程序: android:Manifest.xml中的android:sharedUserId =“ android.uid.system”并用相关ROM的platform.x509.pem,platform.pk8签名到SD卡中。系统会提醒您权限被拒绝。也许这是一个Android系统的安全性机制。但是,当我在Android 4.4.2的Android官方模拟器上测试我的应用程序时,它运行正常,我不知道为什么。

Maybe your situation is not the same as mine.But wish some help for you! 也许您的情况与我的情况不同,但希望对您有所帮助! If you can read Chinese , you can read this article in my personal blog. 如果您会读中文,则可以在我的个人博客中阅读此文章。 It tells more about the error above. 它提供了有关上述错误的更多信息。

http://www.ifeegoo.com/android-debug-static-storage-paths-are-not-available-from-aid-system-error-analysis-and-solution.html http://www.ifeegoo.com/android-debug-static-storage-paths-are-not-available-from-aid-system-error-analysis-and-solution.html

It looks like you are using a static field where you shouldn't. 看来您正在使用不应使用的静态字段。 Try to follow it back to where you think the problem might lay as each line is where the error originated. 尝试将其返回到您认为问题可能出在哪里,因为每一行都是错误的起源。 It works from the bottom up in this case. 在这种情况下,它从下至上起作用。 It looks like you had a throw exception. 看来您有抛出异常。 So if you have a static field in a throwable event, that is most likely your cause. 因此,如果在throwable事件中有一个静态字段,则很可能是您的原因。 It's too hard to tell without the source code 没有源代码很难说

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM