Android应用突然停止-应用内购买

Android应用突然停止-应用内购买,android,permissions,crash,in-app-billing,android-logcat,Android,Permissions,Crash,In App Billing,Android Logcat,在我的android应用程序中实现应用内购买后,当我关闭它时,它突然停止。我正努力想知道log cat中的问题是什么。我收到了错误 Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL 但是我以前收到过这个错误,应用程序仍然运行良好。这是我的

在我的android应用程序中实现应用内购买后,当我关闭它时,它突然停止。我正努力想知道log cat中的问题是什么。我收到了错误

Permission Denial: get/set setting for user asks to run as user -2 but is calling from
user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
但是我以前收到过这个错误,应用程序仍然运行良好。这是我的日志猫,我不确定我需要添加多少,如果太多,我很抱歉。请让我知道,如果我需要添加更多,谢谢

D/SSRMv2:Monitor( 2347): SIOP:: AP = 450 (read only)
I/InputReader( 2347): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.16208 ] when=116815167044000
I/InputDispatcher( 2347): Delivering touch to: action: 0x0
I/InputReader( 2347): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=116815315918000
I/InputDispatcher( 2347): Delivering touch to: action: 0x1
D/BatteryService( 2347): update start
D/BatteryService( 2347): level:80, scale:100, status:2, health:2, present:true, voltage: 4085, temperature: 467, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303550, invalid charger:0, online:4, charge type:1, current avg:460
D/SSRMv2:Monitor( 2347): SIOP:: AP = 450, Prev AP = 450, Duration = 10006
D/SSRMv2:Monitor( 2347): SIOP:: AP = 450 (read only)
I/InputReader( 2347): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.16209 ] when=116820660525000
D/InputDispatcher( 2347): Waiting for application to become ready for input: xxxx Reason: Waiting because the touched window has not finished processing the input events that were previously delivered to it.
D/PowerManagerService( 2347): [api] userActivityFromNative : 50 (event: 2 flags: 0)
D/SensorService( 2347):   0.4 9.9 -0.1
I/InputReader( 2347): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=116820774347000
D/SSRMv2:Monitor( 2347): SIOP:: AP = 450 (read only)
I/dumpstate(29002): done
D/BatteryService( 2347): Sending ACTION_BATTERY_CHANGED.
D/SSRMv2:CustomFrequencyManagerService( 2347): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  pkgName : ACTIVITY_RESUME_BOOSTER@5
I/power   ( 2347): *** acquire_dvfs_lock : lockType : 1  freq : 1200000 
W/ActivityManager( 2347): mDVFSHelper.acquire()
D/dalvikvm( 2347): GC_FOR_ALLOC freed 201K, 17% free 52076K/62236K, paused 330ms, total 331ms
I/ActivityManager( 2347): Process com.jb.gosms.emoji (pid 28888) (adj 11) has died.
D/InputDispatcher( 2347): Waiting for application to become ready for input: xxxx Reason: Waiting because the touched window is paused.
I/InputDispatcher( 2347): Window spent 8210.1ms processing the last input event: MotionEvent(action=0, deviceId=5, source=0x00001002, displayId=0)
I/InputDispatcher( 2347): Window spent 8061.8ms processing the last input event: MotionEvent(action=1, deviceId=5, source=0x00001002, displayId=0)
I/ActivityManager( 2347): Process com.google.android.apps.plus (pid 28904) (adj 9) has died.
W/Choreographer(28777): Already have a pending vsync event.  There should only be one at a time.
I/ActivityManager( 2347): Process com.facebook.katana (pid 28332) (adj 8) has died.
D/MoPub   (28777): Third-party network timed out.
D/STATUSBAR-NetworkController( 8423): onSignalStrengthsChanged signalStrength=SignalStrength: 11 -1 -1 -1 -1 -1 -1 99 -140 -20 -200 -1 2147483647 gsm|lte 0x4 level=4
D/SSRMv2:Monitor( 2347): SIOP:: AP = 450 (read only)
D/STATUSBAR-NetworkController( 8423): onSignalStrengthsChanged signalStrength=SignalStrength: 11 -1 -1 -1 -1 -1 -1 99 -140 -20 -200 -1 2147483647 gsm|lte 0x3 level=3
D/STATUSBAR-NetworkController( 8423): refreshSignalCluster: data=2 bt=false
V/MoPub   (28777): MoPubErrorCode: Third-party network failed to respond in a timely manner.
D/MoPub   (28777): Loading failover url: http://ads.mopub.com/m/ad?v=6&id=9228ebfca6504982941c5601765f658a&nv=1.17.2.0&dn=samsung%2CGT-I9300%2Cm0xx&udid=sha%3A32bc9016036e33b67730c1fadad5c452541e38a5&q=FBATTRID%3Aa3f781d2-2ba6-4265-9690-e4fe0b244cda&z=%2B0200&o=p&sc_a=2.0&mr=1&mcc=242&mnc=05&iso=no&cn=One%20Call&ct=3&av=1.3.8&android_perms_ext_storage=1&request_id=08889b4ab90911e3af000025907c4175&exclude=fbab69084c5611e381c11231392559e4
D/MoPub   (28777): Loading url: http://ads.mopub.com/m/ad?v=6&id=9228ebfca6504982941c5601765f658a&nv=1.17.2.0&dn=samsung%2CGT-I9300%2Cm0xx&udid=sha%3A32bc9016036e33b67730c1fadad5c452541e38a5&q=FBATTRID%3Aa3f781d2-2ba6-4265-9690-e4fe0b244cda&z=%2B0200&o=p&sc_a=2.0&mr=1&mcc=242&mnc=05&iso=no&cn=One%20Call&ct=3&av=1.3.8&android_perms_ext_storage=1&request_id=08889b4ab90911e3af000025907c4175&exclude=fbab69084c5611e381c11231392559e4
I/MoPub   (28777): Fetching ad for task #1
D/STATUSBAR-NetworkController( 8423): onSignalStrengthsChanged signalStrength=SignalStrength: 10 -1 -1 -1 -1 -1 -1 99 -140 -20 -200 -1 2147483647 gsm|lte 0x3 level=3
D/STATUSBAR-IconMerger( 8423): checkOverflow(240), More:false, Req:false Child:2
D/STATUSBAR-NetworkController( 8423): onSignalStrengthsChanged signalStrength=SignalStrength: 9 -1 -1 -1 -1 -1 -1 99 -140 -20 -200 -1 2147483647 gsm|lte 0x3 level=3
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
D/STATUSBAR-StatusBarManagerService( 2347): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
D/CrashAnrDetector( 2347): processName: com.guessSound.guessSound
D/CrashAnrDetector( 2347): broadcastEvent : com.guessSound.guessSound data_app_crash
D/STATUSBAR-BatteryController( 8423): onReceive() - ACTION_BATTERY_CHANGED
D/STATUSBAR-BatteryController( 8423): onReceive() - BATTERY_STATUS_CHARGING:
D/webviewglue(28777): nativeDestroy view: 0x5979cee0
D/webviewglue(28777): nativeDestroy view: 0x59c399f0
D/STATUSBAR-IconMerger( 8423): checkOverflow(240), More:false, Req:false Child:2
D/STATUSBAR-PhoneStatusBar( 8423):  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true
D/STATUSBAR-AirplaneModeQuickSettingButton( 8423): mPhoneStateListener - inAirplaneMode: false
D/STATUSBAR-NetworkController( 8423): onServiceStateChanged state=0
D/STATUSBAR-NetworkController( 8423): updateDataNetType()
D/STATUSBAR-NetworkController( 8423): Nothing, mRoamingIconId = 0
D/WindowManager( 2347): computeScreenConfigurationLocked() set config.orientation=1 dw=720 dh=1280 Callers=com.android.server.wm.WindowManagerService.updateOrientationFromAppTokensLocked:5171 com.android.server.wm.WindowManagerService.updateOrientationFromAppTokens:5142 com.android.server.am.ActivityStack.realStartActivityLocked:1021 
I/SurfaceFlinger( 1935): id=2621 createSurf (1x1),1 flag=4, huessSound
D/PowerManagerService( 2347): setKeyboardVisibility: false
I/GATE    (28777): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
I/InputDispatcher( 2347): Delivering touch to: action: 0x0
I/InputDispatcher( 2347): Delivering touch to: action: 0x1
D/WifiController( 2347): SET_AP_BOOSTER_FLAG ignored due to state change
D/WifiService( 2347): onDataConnectionStateChanged: state -2, networkType - UMTS
D/STATUSBAR-NetworkController( 8423): onDataConnectionStateChanged: state=2 type=3
D/STATUSBAR-NetworkController( 8423): updateDataNetType()
D/STATUSBAR-NetworkController( 8423): Nothing, mRoamingIconId = 0
D/STATUSBAR-NetworkController( 8423): refreshSignalCluster: data=2 bt=false
D/ContextualPageReceiver(20224): mContextualPageReceiver: ACTION_SERVICE_STATE_CHANGED isRoaming : false
D/STATUSBAR-IconMerger( 8423): checkOverflow(240), More:false, Req:false Child:2
W/ActivityManager( 2347): Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
E/DatabaseUtils( 2347): Writing exception to parcel
E/DatabaseUtils( 2347): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
E/DatabaseUtils( 2347):     at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
E/DatabaseUtils( 2347):     at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
E/DatabaseUtils( 2347):     at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
E/DatabaseUtils( 2347):     at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
E/DatabaseUtils( 2347):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
E/DatabaseUtils( 2347):     at android.os.Binder.execTransact(Binder.java:388)
E/DatabaseUtils( 2347):     at com.android.server.SystemServer.init1(Native Method)
E/DatabaseUtils( 2347):     at com.android.server.SystemServer.main(SystemServer.java:2012)
E/DatabaseUtils( 2347):     at java.lang.reflect.Method.invokeNative(Native Method)
E/DatabaseUtils( 2347):     at java.lang.reflect.Method.invoke(Method.java:525)
E/DatabaseUtils( 2347):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
E/DatabaseUtils( 2347):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
E/DatabaseUtils( 2347):     at dalvik.system.NativeStart.main(Native Method)
I/power   ( 2347): *** release_dvfs_lock : lockType : 1 
I/power   ( 2347): *** acquire_dvfs_lock : lockType : 1  freq : 1200000 
D/SSRMv2:CustomFrequencyManagerService( 2347): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  tag : ACTIVITY_RESUME_BOOSTER@5
D/SSRMv2:CustomFrequencyManagerService( 2347): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  pkgName : ACTIVITY_RESUME_BOOSTER@5
W/ActivityManager( 2347): mDVFSHelper.acquire()
V/RealCellState( 2689): telephonyManager network type is 3
D/PhoneApp( 2708): mReceiver: ACTION_ANY_DATA_CONNECTION_STATE_CHANGED
D/AbsListView(28777): unregisterIRListener() is called 
D/FileWriteThread( 2708): FileWriteThread : threadType = 2
D/NotificationMgr( 2708): hideDataDisconnectedRoaming()...
D/MobileDataStateTracker( 2347): default: Received state=CONNECTED, old=CONNECTED, reason=(unspecified)
D/AbsListView(28777): Get MotionRecognitionManager
D/MotionRecognitionService( 2347):  ssp status : false
D/dalvikvm(28777): GC_FOR_ALLOC freed 6233K, 27% free 20403K/27816K, paused 57ms, total 57ms
D/StatusChecker(29074): onReceive : android.intent.action.SERVICE_STATE
D/StatusChecker(29074): Service state changed : 0
D/STATUSBAR-NetworkController( 8423): onDataActivity: direction=2
D/STATUSBAR-NetworkController( 8423): refreshSignalCluster: data=2 bt=false
I/BootupListener( 2708): mPendingNetworkManualSelection : false
W/FlurryAgent(28777): Continuing previous session
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 4
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 0
D/AbsListView(28777): unregisterIRListener() is called 
D/WindowManager( 2347): computeScreenConfigurationLocked() set config.orientation=1 dw=720 dh=1280 Callers=com.android.server.wm.WindowManagerService.updateOrientationFromAppTokensLocked:5171 com.android.server.wm.WindowManagerService.updateOrientationFromAppTokens:5142 com.android.server.am.ActivityStack.realStartActivityLocked:1021 
D/PowerManagerService( 2347): setKeyboardVisibility: false
D/webviewglue(28777): nativeDestroy view: 0x596c5bb0
D/webviewglue(28777): nativeDestroy view: 0x57dc5168
I/SurfaceFlinger( 1935): id=2622 createSurf (1x1),1 flag=4, OewGameActi
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): Get MotionRecognitionManager
D/MotionRecognitionService( 2347):  ssp status : false
D/dalvikvm( 2896): GC_CONCURRENT freed 410K, 30% free 10387K/14804K, paused 4ms+4ms, total 44ms
W/FlurryAgent(28777): Continuing previous session
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 4
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 0
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): unregisterIRListener() is called 
D/dalvikvm(28777): GC_CONCURRENT freed 651K, 23% free 21680K/27816K, paused 11ms+6ms, total 58ms
I/SurfaceFlinger( 1935): id=2623 createSurf (720x1280),1 flag=4, OewGameActi
D/dalvikvm(28826): GC_EXPLICIT freed 1284K, 19% free 11047K/13512K, paused 4ms+16ms, total 93ms
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): unregisterIRListener() is called 
D/AbsListView(28777): unregisterIRListener() is called 
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
I/power   ( 2347): *** release_dvfs_lock : lockType : 1 
D/SSRMv2:CustomFrequencyManagerService( 2347): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  tag : ACTIVITY_RESUME_BOOSTER@5
W/ActivityManager( 2347): mDVFSHelper.release()
I/power   ( 2347): *** acquire_dvfs_lock : lockType : 1  freq : 1200000 
D/AbsListView(28777): unregisterIRListener() is called 
D/SSRMv2:CustomFrequencyManagerService( 2347): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  pkgName : ACTIVITY_RESUME_BOOSTER@8
D/MoPub   (28777): Ad Unit (9228ebfca6504982941c5601765f658a) going invisible: disabling refresh
D/MoPub   (28777): Automatic refresh for com.mopub.mobileads.AdConfiguration@42d65750 set to: false.
D/STATUSBAR-NetworkController( 8423): onDataActivity: direction=0
D/STATUSBAR-NetworkController( 8423): refreshSignalCluster: data=2 bt=false
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
I/SurfaceFlinger( 1935): id=2622 Removed OewGameActi (3/7)
I/SurfaceFlinger( 1935): id=2622 Removed OewGameActi (-2/7)
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
W/FlurryAgent(28777): Trying to end session
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 4
D/AbsListView(28777): unregisterIRListener() is called 
D/LocationManagerService( 2347): getProviders()=[]
D/LocationManagerService( 2347): getProviders()=[]
D/LocationManagerService( 2347): getBestProvider(Criteria[power=NO_REQ acc=---], true)=null
W/FlurryAgent(28777): Trying to end session
D/AbsListView(28777): onVisibilityChanged() is called, visibility : 4
D/AbsListView(28777): unregisterIRListener() is called 
D/LocationManagerService( 2347): getProviders()=[]
D/LocationManagerService( 2347): getProviders()=[]
D/LocationManagerService( 2347): getBestProvider(Criteria[power=NO_REQ acc=---], true)=null
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
V/WindowManager( 2347): Window{43202888 u0 Keyguard}mOrientationRequetedFromKeyguard=false
I/power   ( 2347): *** release_dvfs_lock : lockType : 1 
D/SSRMv2:CustomFrequencyManagerService( 2347): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2347  tag : ACTIVITY_RESUME_BOOSTER@8
更新2.0


我打电话给successmethod to buy中的ConsumerPurchase。这会导致问题吗?在我使用successmethod删除ConsumerPurchase后,看起来我没有收到该错误。。那么,在我购买了消费品之后,如何在不使用ConsumerPurchase的情况下购买该消费品呢?如果我添加一个计时器,它能工作吗?或者它有更好的解决方案吗?

用户0通常表示root用户。您是否以root用户身份运行应用程序?

请包含您的代码和相关清单元素。您是否添加了权限
android.permission.interactive\u跨用户\u FULL
?您的logcat似乎在抱怨此权限丢失。是的,我确实添加了它,但在我阅读之后,您是否添加它并不重要?我在@323goIm上面添加了一些代码,在successmethod to buy中调用ConsumerPurchase。这会导致问题吗?在我使用successmethod删除ConsumerPurchase后,看起来我没有收到该错误。。那么,在我购买了消费品之后,如何在不使用ConsumerPurchase的情况下购买该消费品呢?如果我添加一个计时器,它能工作吗?或者它有更好的解决方案吗?
<manifest android:hardwareAccelerated="true" android:versionCode="5" android:versionName="1.3.0" android:windowSoftInputMode="adjustPan" package="com.guessSound.guessSound" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
    <application android:debuggable="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:name="com.guessSound.guessSound.MainApplication">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="com.guessSound.guessSound.GuessThisSound" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:name="com.parse.PushService" />
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
    </application>
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.RECORD_VIDEO" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.android.vending.BILLING" />
</manifest>
private void buy(final String sku){
    /* TODO: for security, generate your payload here for verification. See the comments on 
     *        verifyDeveloperPayload() for more info. Since this is a sample, we just use 
     *        an empty string, but on a production app you should generate this. */
    final String payload = "";

    if (mHelper == null){
        callbackContext.error("Billing plugin was not initialized");
        return;
    }

    this.cordova.setActivityResultCallback(this);

    mHelper.launchPurchaseFlow(cordova.getActivity(), sku, RC_REQUEST, 
            mPurchaseFinishedListener, payload);

}

private void consumePurchase(JSONArray data) throws JSONException{

    if (mHelper == null){
        callbackContext.error("Did you forget to initialize the plugin?");
        return;
    } 

    String sku = data.getString(0);

    // Get the purchase from the inventory
    Purchase purchase = myInventory.getPurchase(sku);
    if (purchase != null)
        // Consume it
        mHelper.consumeAsync(purchase, mConsumeFinishedListener);
    else
        callbackContext.error(sku + " is not owned so it cannot be consumed");
}