Ubuntu (10.04) only supports Java 1.6 (and prefers OpenJDK too). Here's how to get Sun Java 1.5 installed on Ubuntu 10.04:
Add the following to /etc/apt/sources.list:
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
Update the package list:
sudo apt-get update
Install Sun Java 1.5/1.6:
sudo apt-get install sun-java5-jdk
sudo apt-get install sun-java6-jdk
Depending on your setup you might need to set this as the default. Check what version is default:
java -version
And list all Java versions installed:
sudo update-java-alternatives -l
Then if necessary:
sudo update-java-alternatives -s java-1.5.0-sun
or
sudo update-java-alternatives -s java-1.6.0-sun
2010年8月13日星期五
2010年8月6日星期五
Learn Android from APK
1. Unpack the APK file by using apktool (http://code.google.com/p/android-apktool/).
Apktool will generate the readable XML files, include the AndroidMenifest.XML and layout XML files. It also will generate the Java bytecode from java class.
2. Rename the APK to ZIP and unzip it, get the DEX file. Using dex2jar (http://code.google.com/p/dex2jar/)
Generate the JAR file.
3. Get Java file by JD (http://java.decompiler.free.fr/).
Generate the java files
4. Using Source Insight to browser the code.
Apktool will generate the readable XML files, include the AndroidMenifest.XML and layout XML files. It also will generate the Java bytecode from java class.
2. Rename the APK to ZIP and unzip it, get the DEX file. Using dex2jar (http://code.google.com/p/dex2jar/)
Generate the JAR file.
3. Get Java file by JD (http://java.decompiler.free.fr/).
Generate the java files
4. Using Source Insight to browser the code.
Google Android secret_code for launching hidden activity
Dial *#*#<code>#*#* to launch the hidden activities.
For example:
Dial <*#*#4636#*#*> will be received by "TestingSettingsBroadcastReceiver".
--Phone.java------------------------------------------------------------------------------
static boolean handleSecretCode(Context context, String input) {
// Secret codes are in the form *#*#
int len = input.length();
if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {
Intent intent = new Intent(Intents.SECRET_CODE_ACTION,
Uri.parse("android_secret_code://" + input.substring(4, len - 4)));
context.sendBroadcast(intent);
return true;
}
return false;
}
------------------------------------------------------------------------------
<receiver android:name="TestingSettingsBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
</intent-filter>
</receiver>
------------------------------------------------------------------------------
<receiver android:name="TestingSettingsBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="225" />
</intent-filter>
</receiver>
For example:
Dial <*#*#4636#*#*> will be received by "TestingSettingsBroadcastReceiver".
--Phone.java------------------------------------------------------------------------------
static boolean handleSecretCode(Context context, String input) {
// Secret codes are in the form *#*#
#*#*int len = input.length();
if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {
Intent intent = new Intent(Intents.SECRET_CODE_ACTION,
Uri.parse("android_secret_code://" + input.substring(4, len - 4)));
context.sendBroadcast(intent);
return true;
}
return false;
}
------------------------------------------------------------------------------
<receiver android:name="TestingSettingsBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
</intent-filter>
</receiver>
------------------------------------------------------------------------------
<receiver android:name="TestingSettingsBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="225" />
</intent-filter>
</receiver>
订阅:
博文 (Atom)