- Stop an Android app
$adb shell am force-stop com.my.app.pkg
- Uninstall a package
$adb uninstall com.my.app.pkg
- Install a package
$adb install path/to/pkg/com.my.app.pkg
Sunday, May 12, 2013
Some adb Commands for Android Debugging
Get Started with JNI
Step 1: Create a Java test file JNITest.java
public class JNITest { public native void printString(); static { System.loadLibrary("printstr"); } public void print() { printString(); } public static void main(String args[]) { (new JNITest()).print(); } }Step 2: Compile the Java file and generate a header file JNITest.h
$javac JNITest.java $javah -jni JNITestStep 3: Create a C test file printstr.c
#include <stdio.h> #include <jni.h> #include "JNITest.h" JNIEXPORT void JNICALL Java_JNITest_printString (JNIEnv* env, jobject obj) { printf("Hello, World!\n"); }Step 4: Compile C file to produce the native lib "libprintstr.jnilib"
$gcc -dynamiclib -o libprintstr.jnilib -I/System/Library/Frameworks/JavaVM.framework/Headers printstr.c -framework JavaVMStep 5: Run the Java test, which would show "Hello World!"
$java JNITest
Friday, May 10, 2013
First Try of Inserting Source Codes
Hightlight the source code with google
code-prettify in two simple steps:
- add the following script to the HTML file:
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
- wrap the code piece with <pre class="prettyprint"> </pre> tag pair
public class Test { public static void main(String args[]) { System.out.println("Hello World!"); } }Hello World in C
include <stdio.h> int main() { printf("Hello World!"); return 0; }Hello World in C++
include <iostream> using namespace std; int main() { cout<<"Hello World!"; return 0; }HelloWorld in Assembly:
section .text global _start (ld) _start: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 mov eax,1 int 0x80 section .data msg db 'Hello, World!',0xa len equ $ - msgHelloWorld in Python:
print "Hello World!"
Subscribe to:
Posts (Atom)