Azure移动应用:Android .get()导致应用冻结

时间:2016-06-08 21:37:59

标签: android azure freeze

我有一个类User,它有几个属性,String名为ID,因此它匹配我的名为User的数据库表。目前我的表User是空的。 每当我尝试:

mClient.getTable(User.class).insert(myUser).get();

mClient.getTable(User.class).execute().get();

我的应用程序在白色屏幕上冻结,控制台显示没有错误。我在catch子句中执行的stackTrace或打印从不出现。

我得到的唯一错误是:

06-08 23:23:35.287 28469-28469/t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86

以下是我在onCreate方法中使用的代码:

User myUser = new User();
// fill in myUser's fields but Id.
new Runnable() {
        @Override
        public void run() {
            try {
                User myUser2 = mClient.getTable(User.class).insert(myUser).get();
                System.out.println("Successfully added the user !");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }.run();

我是azure的新手,我无法找到朋友谷歌的任何帮助。提前谢谢。

编辑:这是整个logcat:

t2g.com.travel2gather I/art: Not late-enabling -Xcheck:jni (already on)
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: System.exit called, status: 1
t2g.com.travel2gather I/AndroidRuntime: VM exiting with result code 1, cleanup skipped.
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
t2g.com.travel2gather D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
                                    [ 06-08 23:19:29.602 24915:24915 D/         ]
                                    HostConnection::get() New Host Connection established 0xabead140, tid 24915
                                    [ 06-08 23:19:29.665 24915:24962 D/         ]
                                    HostConnection::get() New Host Connection established 0xa313a110, tid 24962
t2g.com.travel2gather I/OpenGLRenderer: Initialized EGL, version 1.4
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa2cee100, error=EGL_SUCCESS
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
t2g.com.travel2gather D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
                                    [ 06-08 23:21:25.518 26595:26595 D/         ]
                                    HostConnection::get() New Host Connection established 0xabead0c0, tid 26595
                                    [ 06-08 23:21:25.587 26595:26642 D/         ]
                                    HostConnection::get() New Host Connection established 0xa3134130, tid 26642
t2g.com.travel2gather I/OpenGLRenderer: Initialized EGL, version 1.4
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa2cc2220, error=EGL_SUCCESS
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/data/t2g.com.travel2gather/lib
t2g.com.travel2gather W/art: Suspending all threads took: 11.368ms
t2g.com.travel2gather E/Surface: getSlotFromBufferLocked: unknown buffer: 0xabea8b30
t2g.com.travel2gather I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa2cc2220, error=EGL_SUCCESS
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa36a0480, error=EGL_SUCCESS
t2g.com.travel2gather E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa2971570
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/data/t2g.com.travel2gather/lib
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa227e720, error=EGL_SUCCESS
t2g.com.travel2gather W/art: Suspending all threads took: 10.473ms
t2g.com.travel2gather I/art: Not late-enabling -Xcheck:jni (already on)
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
t2g.com.travel2gather I/art: Background partial concurrent mark sweep GC freed 8584(1343KB) AllocSpace objects, 5(1600KB) LOS objects, 39% free, 3MB/6MB, paused 1.655ms total 226.868ms
t2g.com.travel2gather D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
                                    [ 06-08 23:22:25.364 27456:27456 D/         ]
                                    HostConnection::get() New Host Connection established 0xab6d42e0, tid 27456
t2g.com.travel2gather W/art: Verification of void com.squareup.okhttp.internal.http.HttpEngine.readResponse() took 169.113ms
                         [ 06-08 23:22:25.428 27456:27508 D/         ]
                         HostConnection::get() New Host Connection established 0xab6d48c0, tid 27508
t2g.com.travel2gather I/OpenGLRenderer: Initialized EGL, version 1.4
t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented
t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa37d7c80, error=EGL_SUCCESS
t2g.com.travel2gather W/art: Verification of okio.Source com.squareup.okhttp.internal.http.HttpConnection.newChunkedSource(com.squareup.okhttp.internal.http.HttpEngine) took 157.042ms
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/data/t2g.com.travel2gather/lib
t2g.com.travel2gather I/art: Background partial concurrent mark sweep GC freed 107958(3MB) AllocSpace objects, 1(240KB) LOS objects, 40% free, 4MB/6MB, paused 9.332ms total 199.896ms
t2g.com.travel2gather W/art: Suspending all threads took: 5.557ms
t2g.com.travel2gather I/art: Background sticky concurrent mark sweep GC freed 70224(2MB) AllocSpace objects, 6(364KB) LOS objects, 0% free, 7MB/7MB, paused 7.961ms total 76.058ms
t2g.com.travel2gather I/art: Background partial concurrent mark sweep GC freed 11587(629KB) AllocSpace objects, 5(2040KB) LOS objects, 39% free, 5MB/8MB, paused 5.417ms total 20.421ms
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: Background sticky concurrent mark sweep GC freed 14786(1156KB) AllocSpace objects, 1(20KB) LOS objects, 72% free, 1024KB/3MB, paused 19.184ms total 31.942ms
t2g.com.travel2gather W/art: Suspending all threads took: 5.952ms
t2g.com.travel2gather W/art: Suspending all threads took: 6.214ms
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: System.exit called, status: 1
t2g.com.travel2gather I/AndroidRuntime: VM exiting with result code 1, cleanup skipped.
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: WaitForGcToComplete blocked for 5.428ms for cause Background
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: Background sticky concurrent mark sweep GC freed 164(34KB) AllocSpace objects, 0(0B) LOS objects, 22% free, 666KB/856KB, paused 8.272ms total 38.306ms
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86
t2g.com.travel2gather I/art: Background sticky concurrent mark sweep GC freed 6278(406KB) AllocSpace objects, 0(0B) LOS objects, 13% free, 1497KB/1729KB, paused 5.499ms total 20.437ms

1 个答案:

答案 0 :(得分:1)

  

Azure移动应用:Android .get()导致应用冻结

因为调用.run()作为方法而不是将Runnable传递给Thread

创建Thread

Runnable mRunnable=new Runnable()
    {
     // your code here
    };

并将mRunnable对象传递给它:

Thread thread = new Thread(mRunnable);
thread.start();