FATAL Exception のメイン エラーが発生しました。
コードは次のとおりです。
private void copyStream(String assetFilename, String outFileName ) throws IOException {
Process mSuProcess; mSuProcess = Runtime.getRuntime().exec("su"); ContextWrapper myContext = null; InputStream myInput = myContext.getAssets().open(assetFilename); OutputStream myOutput = new FileOutputStream(outFileName); //transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[2048]; int length; while ((length = myInput.read(buffer))>0){ myOutput.write(buffer, 0, length); } //Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } public void copyon(View view) throws IOException { copyStream("floaton.xml","/system/etc/excluded-input-devices.xml"); } public void copyoff(View view) throws IOException { copyStream("floatoff.xml","/system/etc/excluded-input-devices.xml"); }
そしてlogcat
09-16 19:52:26.654: E/AndroidRuntime(294):FATAL EXCEPTION: main 09-16 19:52:26.654: E/AndroidRuntime(294):java.lang.IllegalStateException: アクティビティ 09 のメソッドを実行できませんでした-16 19:52:26.654: E/AndroidRuntime(294): android.view.View$1.onClick(View.java:2144) 09-16 19:52:26.654: E/AndroidRuntime(294): アンドロイドで。 view.View.performClick(View.java:2485) 09-16 19:52:26.654: E/AndroidRuntime(294): android.view.View$PerformClick.run(View.java:9080) 09-16 19: 52:26.654: E/AndroidRuntime(294): android.os.Handler.handleCallback(Handler.java:587) 09-16 19:52:26.654: E/AndroidRuntime(294): android.os.Handler.dispatchMessage (Handler.java:92) 09-16 19:52:26.654: E/AndroidRuntime(294): android.os.Looper.loop(Looper.java:123) 09-16 19:52:26.654: E/AndroidRuntime (294): android.app.ActivityThread.main(ActivityThread.java:3683) 09-16 19:52:26.654: E/AndroidRuntime(294): java.lang.reflect.Method.invokeNative(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): java.lang.reflect.Method.invoke(Method.java:507) 09-16 19:52:26.654: E/AndroidRuntime(294): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit. java:839) 09-16 19:52:26.654: E/AndroidRuntime(294): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 09-16 19:52:26.654: E/ AndroidRuntime(294): dalvik.system.NativeStart.main(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): 原因: java.lang.reflect.InvocationTargetException 09-16 19:52: 26.654: E/AndroidRuntime(294): at java.lang.reflect.Method.invokeNative(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.lang.reflect.Method.invoke( Method.java:507) 09-16 19:52:26。654: E/AndroidRuntime(294): android.view.View$1.onClick(View.java:2139) 09-16 19:52:26.654: E/AndroidRuntime(294): ... 11 もっと見る 09-16 19 :52:26.654: E/AndroidRuntime(294): 原因: java.io.IOException: 壊れたパイプ 09-16 19:52:26.654: E/AndroidRuntime(294): org.apache.harmony.luni.platform. OSFileSystem.write(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171) 09-16 19:52:26.654: E /AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java:300) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java: 256) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.DataOutputStream.writeBytes(DataOutputStream.java:167)で2139) 09-16 19:52:26.654: E/AndroidRuntime(294): ... 11 09-16 19:52:26.654: E/AndroidRuntime(294): 原因: java.io.IOException: 壊れたパイプ09-16 19:52:26.654: E/AndroidRuntime(294): org.apache.harmony.luni.platform.OSFileSystem.write(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:300) 09- 16 19:52:26.654: E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java:256) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.io. DataOutputStream.writeBytes(DataOutputStream.java:167)2139) 09-16 19:52:26.654: E/AndroidRuntime(294): ... 11 09-16 19:52:26.654: E/AndroidRuntime(294): 原因: java.io.IOException: 壊れたパイプ09-16 19:52:26.654: E/AndroidRuntime(294): org.apache.harmony.luni.platform.OSFileSystem.write(ネイティブ メソッド) 09-16 19:52:26.654: E/AndroidRuntime(294): dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:300) 09- 16 19:52:26.654: E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java:256) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.io. DataOutputStream.writeBytes(DataOutputStream.java:167)壊れたパイプ 09-16 19:52:26.654: E/AndroidRuntime(294): org.apache.harmony.luni.platform.OSFileSystem.write(Native Method) 09-16 19:52:26.654: E/AndroidRuntime(294 ): dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:300) で09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:256) 09-16 19:52:26.654: E/AndroidRuntime(294): Java で。 io.DataOutputStream.writeBytes(DataOutputStream.java:167)壊れたパイプ 09-16 19:52:26.654: E/AndroidRuntime(294): org.apache.harmony.luni.platform.OSFileSystem.write(Native Method) 09-16 19:52:26.654: E/AndroidRuntime(294 ): dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:300) で09-16 19:52:26.654: E/AndroidRuntime(294): java.io.FileOutputStream.write(FileOutputStream.java:256) 09-16 19:52:26.654: E/AndroidRuntime(294): Java で。 io.DataOutputStream.writeBytes(DataOutputStream.java:167)E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java:300) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java :256) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.DataOutputStream.writeBytes(DataOutputStream.java:167) でE/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java:300) 09-16 19:52:26.654: E/AndroidRuntime(294): at java.io.FileOutputStream.write(FileOutputStream.java :256) 09-16 19:52:26.654: E/AndroidRuntime(294): java.io.DataOutputStream.writeBytes(DataOutputStream.java:167) で