No jar package path is added to the BOOTCLASSPATH. After the system is started, the related classes of the custom JAVA-layer system services cannot be found. This is because the custom system service jar package is the basic library file required by Dalvik. If no related path is added, the following error is returned:
W/dalvikvm (2582): Unable to resolve superclass of Lcom/android/server/yourdir/yourService; (1633)
W/dalvikvm (2582): Link of class 'lcom/android/server/yourdir/yourService; 'failed'
D/dalvikvm (2582): DexOpt: unable to opt direct call 0x276b at 0x258 in Lcom/android/server/ServerThread;. run
Three mandatory principles:
Android
Class implementation-System Basics
Preparation of Dalvik Analysis
Dalvik analysis-Class loading
Init. rc:
Export BOOTCLASSPATH/system/framework/core. jar:/system/framework/bouncycastle. jar:/system/framework/ext. jar:/system/framework. jar:/system/framework/android. policy. jar:/system/framework/services. jar:/system/framework/core-junit.jar
BOOTCLASSPATH =/ango/system/framework/core. jar:/ango/system/framework/bouncycastle. jar:/ango/system/framework/ext. jar:/ango/system/framework. jar:/ango/system/framework/android. policy. jar:/ango/system/framework/services. jar:/ango/system/framework/core-junit.jar
D:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/Init. c
// Getenv of classpath and BOOTCLASSPATH configed by init. rc
Static void setCommandLineDefaults ()
Putenv ("BOOTCLASSPATH =/ango/system/framework/core. jar:/ango/system/framework/bouncycastle. jar:/ango/system/framework/ext. jar:/ango/system/framework. jar:/ango/system/framework/android. policy. jar:/ango/system/framework/services. jar:/ango/system/framework/core-junit.jar ");
EnvStr = getenv ("BOOTCLASSPATH ");
If (envStr! = NULL)
GDvm. bootClassPathStr = strdup (envStr );
Else
GDvm. bootClassPathStr = strdup (".");
D:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class. c
/*
* Prepare a ClassPathEntry struct, which at this point only has a valid
* Filename. We need to figure out what kind of file it is, and
* Everything other than directories we need to open it up and see
* What's inside.
*/
Static bool prepareCpe (ClassPathEntry * cpe, bool isBootstrap)
/*
* Convert a colon-separated list of directories, Zip files, and DEX files
* Into an array of ClassPathEntry structs.
*
* During normal startup we fail if there are no entries, because we won't
* Get very far without the basic language support classes, but if we're
* Optimizing a DEX file we allow it.
*
* If entries are added or removed from the bootstrap class path,
* Dependencies in the DEX files will break, and everything doesn't
* Very first entry will need to be regenerated.
*/
Static ClassPathEntry * processClassPath (const char * pathStr, bool isBootstrap)
/*
* Initialize the bootstrap class loader.
*
* Call this after the bootclasspath string has been finalized.
*/
Bool dvmClassStartup (void)