错误:无论是用户还是10066当前进程具有android.permission.BACKUP [英] Error : Neither user 10066 nor current process has android.permission.BACKUP

查看:236
本文介绍了错误:无论是用户还是10066当前进程具有android.permission.BACKUP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发我正在研究关于谷歌备份API的Andr​​oid应用程序,
我阅读本教程
http://www.edumobile.org/android/android-development/backup-经理/

I am developing an android application for which i was studying about Google Backup API , i read this tutorial http://www.edumobile.org/android/android-development/backup-manager/

和试图执行它,但它崩溃所有的时间

and tried to implement it but it is crashing all the time

在logcat的是

07-31 13:39:35.797: E/AndroidRuntime(18279): FATAL EXCEPTION: main
07-31 13:39:35.797: E/AndroidRuntime(18279): java.lang.IllegalStateException: Could not execute method of the activity
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.view.View$1.onClick(View.java:2072)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.view.View.performClick(View.java:2408)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.view.View$PerformClick.run(View.java:8816)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.os.Handler.handleCallback(Handler.java:587)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.os.Handler.dispatchMessage(Handler.java:92)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.os.Looper.loop(Looper.java:123)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.app.ActivityThread.main(ActivityThread.java:4633)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at java.lang.reflect.Method.invokeNative(Native Method)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at java.lang.reflect.Method.invoke(Method.java:521)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at dalvik.system.NativeStart.main(Native Method)
07-31 13:39:35.797: E/AndroidRuntime(18279): Caused by: java.lang.reflect.InvocationTargetException
07-31 13:39:35.797: E/AndroidRuntime(18279):    at com.pref.BackupManagerExample.onRestoreButtonClick(BackupManagerExample.java:164)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at java.lang.reflect.Method.invokeNative(Native Method)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at java.lang.reflect.Method.invoke(Method.java:521)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.view.View$1.onClick(View.java:2067)
07-31 13:39:35.797: E/AndroidRuntime(18279):    ... 11 more
07-31 13:39:35.797: E/AndroidRuntime(18279): Caused by: java.lang.SecurityException: getCurrentTransport: Neither user 10066 nor current process has android.permission.BACKUP.
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.os.Parcel.readException(Parcel.java:1247)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.os.Parcel.readException(Parcel.java:1235)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.app.backup.IBackupManager$Stub$Proxy.getCurrentTransport(IBackupManager.java:444)
07-31 13:39:35.797: E/AndroidRuntime(18279):    at android.app.backup.BackupManager.requestRestore(BackupManager.java:141)
07-31 13:39:35.797: E/AndroidRuntime(18279):    ... 15 more

和menifest是

and the menifest is

   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.pref"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.BACKUP" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
         android:backupAgent="com.pref.BackupManagerExample">
         <activity android:name=".Preff" />



        <activity
            android:name=".PrefrencesActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>
        </activity>


         <meta-data android:name="com.google.android.backup.api_key"
    android:value="AEdPqrEAAAAIo8gaMLEy1sb1bVd6Cyqs5dxPAy8qvFzfILeLWB" />
         <activity
            android:name=".BackupManagerExample"
            android:enabled="true"/>

    </application>

</manifest>

疗法错误是在这里

Ther Error is here

 Resotre.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    // TODO Auto-generated method stub

//此行显示了错误

// This line shows the error

 mBackupManager.requestRestore(
                                    new RestoreObserver() {
                                        public void restoreFinished(int error) {
                                            Log.v(TAG, "Restore finished, error = " + error);
                                            populateUI();
                                        }
                                    }
                            );
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            });

有什么能为这个错误的原因是什么?我怎么才能删除它?

What could be the cause for this error ? And how can i remove it ?

修改

不olny这一点,但我也用这个code,

Not olny this but i also used this code ,

https://github.com/StylingAndroid/Backu$p$pstore

刚看到API的备份工作,这也给了同样的错误。

Just to see how backup API works and this also gave the same error .

07-31 18:10:33.226: E/AndroidRuntime(20664): Caused by: java.lang.SecurityException: getCurrentTransport: Neither user 10072 nor current process has android.permission.BACKUP.

在这里,我读

http://developer.android.com/guide/topics/data/ backup.html

数据备份不能保证适用于所有Android设备。然而,应用程序不会受到不利的事件的影响,一个设备不提供一个备份传输

Data backup is not guaranteed to be available on all Android-powered devices. However, your application is not adversely affected in the event that a device does not provide a backup transport.

我使用的设备是三星Galaxy流行。

The device i am using is a samsung galaxy pop.

推荐答案

您正在尝试直接使用BackupManager,你不能这样做,没有android.permission.BACKUP许可。该权限只授予与平台密钥(基本系统应用程序)签名的软件。

You are trying to use the BackupManager directly and you cannot do that without the android.permission.BACKUP permission. That permission is only granted to apps signed with the platform key (basically system apps).

您正在请求在你的清单中的权限,但如果你同时安装,你应该看到不授予权限观看记录警告你的应用程序。

You are requesting the permission in your manifest but if you watch the logs while you install you should see the "Not granting permission" warning for your app.

那么,到底你的code相一般正确的,但您是刚开始试图调用受保护的方法时,安全异常。

So in the end your code looks generally correct but you are just getting a security exception when trying to call the protected methods.

这篇关于错误:无论是用户还是10066当前进程具有android.permission.BACKUP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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