问题
I am writing a basic android app involving Spen SDK. My XML file is:-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/canvas_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.samsung.sdraw.CanvasView
android:id="@+id/canvas_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
/>
<com.samsung.sdraw.SettingView
android:id="@+id/setting_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
</RelativeLayout>
As soon as I write this XML, some error pops up in my Preview Panel. The screen-shot is attached below:
The error is:-
Rendering Problems:
The following classes could not be instantiated:
- com.samsung.sdraw.CanvasView (Open Class, Show Exception)
- com.samsung.sdraw.SettingView (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details (<-----with regard to com.samsung.sdraw.CanvasView class)
Write access not allowed during rendering (\mnt\sdcard\android\data\null\serial)
at com.android.ide.common.rendering.RenderSecurityException.create(RenderSecurityException.java:52)
at com.android.ide.common.rendering.RenderSecurityManager.checkWrite (RenderSecurityManager.java:544)
at java.io.File.mkdir(File.java:1305)
at java.io.File.mkdirs(File.java:1337)
at com.samsung.sdraw.z.a(SourceFile:23)
at com.samsung.sdraw.z.a(SourceFile:15)
at com.samsung.sdraw.Setting.a(SourceFile:470)
at com.samsung.sdraw.Setting.<init>(SourceFile:261)
at com.samsung.sdraw.ModeContext.<init>(SourceFile:73)
at com.samsung.sdraw.CanvasView.h(SourceFile:735)
at com.samsung.sdraw.CanvasView.<init>(SourceFile:606)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
Diagnostic info for Studio bug report:
Failed path: \mnt\sdcard\android\data\null\serial
Normal temp dir: C:\Users\avinash\AppData\Local\Temp\
Normalized temp dir: C:\Users\avinash\AppData\Local\Temp
Canonical temp dir: C:\Users\avinash\AppData\Local\Temp os.name: Windows 8 os.version: 6.2 java.runtime.version: 1.7.0_55-b13
Exception details (<-----with regard to com.samsung.sdraw.SettingView class)
java.lang.NullPointerException at com.samsung.sdraw.bx.<init>(SourceFile:84)
at com.samsung.sdraw.AbstractSettingView.a(SourceFile:685)
at com.samsung.sdraw.AbstractSettingView.<init>(SourceFile:648)
at com.samsung.sdraw.SettingView.<init>(SourceFile:151)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
Can anybodu help me with these error?
Update: When I run the program, the logcat gives the following warnings once the debugger has settled:
06-10 12:04:58.916 31170-31323/com.example.myapplication4.app E/CB::BeautifyNative﹕ WARNING: Could not load libjni_secime natives
06-10 12:04:58.916 31170-31323/com.example.myapplication4.app W/dalvikvm﹕ No implementation found for native Lcom/bst/HwBeautify/BeautifyNative;.nativeCBInitEngine:()I
06-10 12:04:58.916 31170-31323/com.example.myapplication4.app W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x41fec700)
06-10 12:04:58.921 31170-31323/com.example.myapplication4.app E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-13335
java.lang.UnsatisfiedLinkError: Native method not found: com.bst.HwBeautify.BeautifyNative.nativeCBInitEngine:()I
at com.bst.HwBeautify.BeautifyNative.nativeCBInitEngine(Native Method)
at com.bst.HwBeautify.BeautifyNative.cbInitEngine(SourceFile:107)
at com.bst.HwBeautify.BeautifyManager.b(SourceFile:87)
at com.bst.HwBeautify.BeautifyManager.a(SourceFile:85)
at com.bst.HwBeautify.BeautifyManager$1.run(SourceFile:64)
at java.lang.Thread.run(Thread.java:841)
06-10 12:04:59.891 31170-31170/com.example.myapplication4.app D/dalvikvm﹕ GC_FOR_ALLOC freed 925K, 22% free 14857K/18952K, paused 13ms, total 14ms
06-10 12:04:59.901 31170-31170/com.example.myapplication4.app I/dalvikvm-heap﹕ Grow heap (frag case) to 23.625MB for 6317296-byte allocation
06-10 12:04:59.916 31170-31179/com.example.myapplication4.app D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 17% free 21027K/25124K, paused 13ms, total 13ms
06-10 12:04:59.931 31170-31170/com.example.myapplication4.app D/dalvikvm﹕ GC_FOR_ALLOC freed 2K, 17% free 21025K/25124K, paused 9ms, total 9ms
06-10 12:04:59.946 31170-31170/com.example.myapplication4.app I/dalvikvm-heap﹕ Grow heap (frag case) to 29.648MB for 6317296-byte allocation
06-10 12:04:59.956 31170-31179/com.example.myapplication4.app D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 14% free 27194K/31296K, paused 10ms, total 10ms
06-10 12:05:00.181 31170-31170/com.example.myapplication4.app E/ViewSystem﹕ ViewRootImpl #2 Surface is not valid.
06-10 12:05:00.191 31170-31170/com.example.myapplication4.app W/System.err﹕ java.io.FileNotFoundException: /mnt/sdcard/android/data/com.example.myapplication4.app/serial/1125509560/sprites.raw: open failed: ENOENT (No such file or directory)
06-10 12:05:00.196 31170-31170/com.example.myapplication4.app W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:409)
06-10 12:05:00.196 31170-31170/com.example.myapplication4.app W/System.err﹕ at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
06-10 12:05:00.196 31170-31170/com.example.myapplication4.app W/System.err﹕ at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
06-10 12:05:00.196 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.samsung.sdraw.AbstractModeContext.a(SourceFile:182)
06-10 12:05:00.196 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.samsung.sdraw.AbstractModeContext.serializeContext(SourceFile:143)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.samsung.sdraw.CanvasView.b(SourceFile:7577)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.samsung.sdraw.CanvasView.onDetachedFromWindow(SourceFile:641)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.View.dispatchDetachedFromWindow(View.java:13064)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2798)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2798)
06-10 12:05:00.201 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2798)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2798)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2798)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3368)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5978)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.ViewRootImpl.die(ViewRootImpl.java:5961)
06-10 12:05:00.206 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:378)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:328)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:88)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3677)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.app.ActivityThread.access$1300(ActivityThread.java:165)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)
06-10 12:05:00.211 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5450)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
06-10 12:05:00.216 31170-31170/com.example.myapplication4.app W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
06-10 12:05:00.221 31170-31170/com.example.myapplication4.app W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
06-10 12:05:00.221 31170-31170/com.example.myapplication4.app W/System.err﹕ Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
06-10 12:05:00.221 31170-31170/com.example.myapplication4.app W/System.err﹕ at libcore.io.Posix.open(Native Method)
06-10 12:05:00.221 31170-31170/com.example.myapplication4.app W/System.err﹕ at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
06-10 12:05:00.226 31170-31170/com.example.myapplication4.app W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:393)
06-10 12:05:00.226 31170-31170/com.example.myapplication4.app W/System.err﹕ ... 29 more
来源:https://stackoverflow.com/questions/24133987/basic-sample-program-of-spen-sdk-throws-run-time-exception