debugging certificate expired on ....
android sdk のサンプルコードをビルドしてみようとしたら、こんなのがでた。
debugging certificate expired on...
どうやら、なんか証明書が切れたらしい。
iPhone の開発の時のように証明書入れた覚えも無いが、以前、HT-03A でゴソゴソしていたときの残骸がどこかにあるんだろうな、ってことで、
visible true : Debug certificate expired on ~~ Android Packaging Problemが出た
Error generating final archive: Debug certificate expired on …の解決方法 | mucchinのAndroid戦記
この辺を参考にしてみたら、無事コンパイルできた。
Android アプリ内で直接コマンド実行するとき
Android アプリの中で直接コマンド実行したいときがあろう。
system 関数みたいなもんがあるのかと調べたら、こんな感じにするらしい。
なるほど。おもしろそうじゃなイカ。あとで、やってみよう。
以下、引用。
try { // Executes the command. Process process = Runtime.getRuntime().exec("/system/bin/ls /sdcard"); // Reads stdout. // NOTE: You can write to stdin of the command using // process.getOutputStream(). BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream())); int read; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((read = reader.read(buffer)) > 0) { output.append(buffer, 0, read); } reader.close(); // Waits for the command to finish. process.waitFor(); return output.toString(); } catch (IOException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); }