我正在尝试基于Fousquare API创建Android应用程序。我需要连接到foursquare帐户。我按照说明生成了密钥:github - foursquare-android-oauth但结果是“正在连接失败”。客户端ID和客户端密码在应用程序的设置中。怎么了?
logcat的:
I/ActivityManager( 1355): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=com.foursquare.android.sample/.MainActivity } from pid 1507
D/WindowManagerImpl( 1355): addView, new view, mViews[1]: com.android.internal.policy.impl.PhoneWindow$DecorView@40d5af98
W/dalvikvm( 1507): disableGcForExternalAlloc: true
W/dalvikvm( 1507): disableGcForExternalAlloc: false
D/SensorService( 1355): enable: get sensor name = BMA150 3-axis Accelerometer
D/Sensors ( 1355): Enable akm: en = 1
D/SensorService( 1355): SensorDevice::activate--: handle = 0x0, enabled = 0x1
D/SensorService( 1355): enable: sensor->activate return value = 0x0
D/SensorService( 1355): enable: calling mActiveSensors.add(handle, rec) = (0x0, 0x991fc8)
D/SensorService( 1355): enable: mActiveConnections.indexOf(connection) = 0x0
D/SensorService( 1355): pid=1355, uid=1000
D/AK8975 ( 1260): Compass Start
V/WindowManager( 1355): Starting animation in AppWindowToken{408c6f78 token=HistoryRecord{409ded10 com.htc.launcher/.Launcher}} @ 27969582
V/WindowManager( 1355): Finished animation in AppWindowToken{408c6f78 token=HistoryRecord{409ded10 com.htc.launcher/.Launcher}} @ 27969582
V/WindowManager( 1355): Starting animation in AppWindowToken{40e6f250 token=HistoryRecord{40a891d0 com.foursquare.android.sample/.MainActivity}} @ 27969582
V/WindowManager( 1355): Finished animation in AppWindowToken{40e6f250 token=HistoryRecord{40a891d0 com.foursquare.android.sample/.MainActivity}} @ 27969582
D/AK8975 ( 1260): Ignore M_Sensor: (y, p, r) = ( 139, 0, 3), Status = 0
D/ATRecorder(19226): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@4053d0e0
D/WindowManagerImpl(19226): addView, new view, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView@40538ca8
D/WindowManagerImpl( 1355): finishRemoveViewLocked, mViews[1]: com.android.internal.policy.impl.PhoneWindow$DecorView@40d5af98
I/ActivityManager( 1355): Displayed com.foursquare.android.sample/.MainActivity: +210ms
V/ActivityManager( 1355): Checking to restart com.foursquare.android.sample.MainActivity: changed=0x0, handles=0x0
V/ActivityManager( 1355): oldConfig={ scale=1.0 imsi=250/1 loc=ru_RU touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=61 skin=default fontsize=3}
V/ActivityManager( 1355): newConfig={ scale=1.0 imsi=250/1 loc=ru_RU touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=61 skin=default fontsize=3}
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/green/brightness string=0,len=1
V/NotificationService( 1355): Charging...
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/green/blink string=0,len=1
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/green/off_timer string=0 0,len=3
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/amber/brightness string=1,len=1
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/amber/blink string=0,len=1
D/lights ( 1355): [LedInfo] write attr ok name=/sys/class/leds/amber/off_timer string=0 0,len=3
V/NotificationService( 1355): Turn off Charm Ind LED
W/InputManagerService( 1355): [unbindCurrentClientLocked] Disable input method client.
W/InputManagerService( 1355): [startInputLocked] Enable input method client.
D/BatteryService( 1355): SendIntentforPowersaver
D/BatteryService( 1355): Current powersaver status == NORMAL_STATUS
D/WifiService( 1355): [smart wifi] mSmartWiFiStatus: 0 mBatteryLevel: 88 mWifiConnected: true
D/WifiService( 1355): [smart wifi] ACTION_BATTERY_CHANGED pluggedType: 2
D/StatusBarPolicy( 1507): plugged = true, health = 2, level = 88, mPluggedBatteryLevel = 87, mLowBatteryWarningLevel2 = 25, mshowLowChargingWarning2 = true
E/MyHTC ( 1643): [ImmediateModeProxyMgr] Failed to connect; wait some amount of time before trying again.
W/System.err( 1643): java.net.SocketTimeoutException: Connection timed out
W/System.err( 1643): at org.apache.harmony.luni.platform.OSNetworkSystem.connect(Native Method)
W/System.err( 1643): at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:357)
W/System.err( 1643): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:207)
W/System.err( 1643): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:440)
W/System.err( 1643): at java.net.Socket.connect(Socket.java:1013)
W/System.err( 1643): at com.htc.handsetlib.proxy.ImmediateModeProxy.connect(ImmediateModeProxy.java:195)
W/System.err( 1643): at com.htc.cs.service.ImmediateModeProxyMgr._connectToImcOrStatusServer(ImmediateModeProxyMgr.java:134)
W/System.err( 1643): at com.htc.cs.service.ImmediateModeProxyMgr.onIntent(ImmediateModeProxyMgr.java:198)
W/System.err( 1643): at com.htc.cs.service.ImmediateModeService$PushHandler.handleMessage(ImmediateModeService.java:708)
W/System.err( 1643): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1643): at android.os.Looper.loop(Looper.java:150)
W/System.err( 1643): at android.os.HandlerThread.run(HandlerThread.java:60)
D/MyHTC ( 1643): [ImmediateModeProxyMgr] _connectToImcOrStatusServer(): Fail IMC reconnect time = 172000
D/View (19226): onTouchEvent: viewFlags: 0x18004001
D/View (19226): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false
I/ActivityManager( 1355): Starting activity: Intent { act=android.intent.action.VIEW dat=foursquareauth://authorize?client_id=AP5RF0GZVCLPHHQ5HLHD5KQSYG03XIQUTKV1LXFCEQHPYMKS&v=20130509&androidKeyHash=60%3AA4%3AD9%3A06%3A0E%3AD2%3A27%3A56%3A00%3A57%3AF6%3A5D%3AE0%3AB7%3A65%3A39%3AC2%3AA9%3A64%3A34 cmp=com.joelapenna.foursquared/.OauthWebViewActivity } from pid 19226
E/ResourceType( 1355): Style contains key with bad entry: 0x01010397
E/ResourceType( 1355): Style contains key with bad entry: 0x0101039c
D/WindowManagerImpl( 1355): addView, new view, mViews[1]: com.android.internal.policy.impl.PhoneWindow$DecorView@40dce998
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/ActivityManager( 1355): Start proc com.joelapenna.foursquared for activity com.joelapenna.foursquared/.OauthWebViewActivity: pid=19512 uid=10077 gids={3003, 1015}
V/WindowManager( 1355): Starting animation in AppWindowToken{40e6f250 token=HistoryRecord{40a891d0 com.foursquare.android.sample/.MainActivity}} @ 27971452
V/WindowManager( 1355): Starting animation in AppWindowToken{40d58910 token=HistoryRecord{40b2cf48 com.joelapenna.foursquared/.OauthWebViewActivity}} @ 27971452
V/WindowManager( 1355): Finished animation in AppWindowToken{40e6f250 token=HistoryRecord{40a891d0 com.foursquare.android.sample/.MainActivity}} @ 27971464
V/WindowManager( 1355): Finished animation in AppWindowToken{40d58910 token=HistoryRecord{40b2cf48 com.joelapenna.foursquared/.OauthWebViewActivity}} @ 27971464
D/dalvikvm(19512): GC_CONCURRENT freed 139K, 44% free 3202K/5639K, external 0K/0K, paused 3ms+2ms
D/dalvikvm(19512): GC_CONCURRENT freed 96K, 41% free 3529K/5959K, external 0K/0K, paused 2ms+2ms
I/dalvikvm(19512): Could not find method android.os.StrictMode$ThreadPolicy$Builder.detectCustomSlowCalls, referenced from method com.joelapenna.foursquared.Foursquared.d
W/dalvikvm(19512): VFY: unable to resolve virtual method 1630: Landroid/os/StrictMode$ThreadPolicy$Builder;.detectCustomSlowCalls ()Landroid/os/StrictMode$ThreadPolicy$Builder;
D/dalvikvm(19512): VFY: replacing opcode 0x6e at 0x0011
D/dalvikvm(19512): VFY: dead code 0x0014-003f in Lcom/joelapenna/foursquared/Foursquared;.d ()V
I/ActivityThread(19512): Pub com.joelapenna.foursquared: com.joelapenna.foursquared.providers.GlobalSearchProvider
I/ActivityThread(19512): Pub com.joelapenna.foursquared.db.ConversationsContentProvider: com.joelapenna.foursquared.db.ConversationsContentProvider
I/ActivityThread(19512): Pub com.joelapenna.foursquared.providers.VenueQuerySuggestionsProvider: com.joelapenna.foursquared.providers.VenueQuerySuggestionsProvider
I/ActivityThread(19512): Pub com.joelapenna.foursquared.providers.AppSearchSuggestionProvider: com.joelapenna.foursquared.providers.AppSearchSuggestionProvider
I/ActivityThread(19512): Pub com.joelapenna.foursquared.providers.foursquarebridgeprovider: com.joelapenna.foursquared.providers.FoursquareBridgeProvider
I/ActivityThread(19512): Pub com.joelapenna.foursquared.providers.FriendsSearchSuggestionProvider: com.joelapenna.foursquared.providers.FriendsSearchSuggestionProvider
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/keystore( 1257): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
I/dalvikvm(19512): Could not find method android.os.StrictMode$VmPolicy$Builder.detectLeakedClosableObjects, referenced from method com.foursquare.core.h.z.a
W/dalvikvm(19512): VFY: unable to resolve virtual method 1638: Landroid/os/StrictMode$VmPolicy$Builder;.detectLeakedClosableObjects ()Landroid/os/StrictMode$VmPolicy$Builder;
D/dalvikvm(19512): VFY: replacing opcode 0x6e at 0x0025
D/dalvikvm(19512): VFY: dead code 0x0028-0038 in Lcom/foursquare/core/h/z;.a ()V
答案 0 :(得分:0)
点击此链接:
它提供了更多信息,并解释了这个过程。
顺便说一下,如果你可以粘贴确切的错误并提供更多关于你所做的事情的信息,那将会很有帮助....没有足够的信息来帮助你。
答案 1 :(得分:0)
也许您没有在Android清单中设置INTERNET PERMISSION:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>