This is certainly possible. The main difficulty in rebuilding android.webkit
from source lies in the lack of a correct build environment. It was never intended to be built outside of the target platform, but a couple of simple hacks around the sources make it quite easy to accomplish.
First of all, the whole android.webkit
package business has to be renamed for obvious reasons, since an android.webkit.WebView
class would already be available during runtime. Use sed
on all the frameworks/base/core/java/android/webkit
tree for example.
Basically you have to grab the full source tree, initialize a build environment (More information here http://source.android.com/source/initializing.html), make framework
to make the internal runtime environment available, create a new development platform, replace all the classes from framework.jar
(after building it's in out/target/common/obj/JAVA_LIBRARIES/framework_intermediaries/classes.jar
) into android.jar
of the platform, build your own webkit
package against this new platform that contains the internals.
Check out https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/ for more information on getting an internal runtime available for development purposes.
You will also need core_intermediaries
, bouncycastle_intermediaries
and others in order to compile webkit
, these are all available when make framework
is invoked, look at the errors when building your webkit
package and grep the out/target/common/obj/JAVA_LIBRARIES/
to figure out which classes contain the symbols.
That's not all, however, the package uses libwebcore.so
which exposes native methods to the android.webkit
package; this would have to have all native method bindings registered to your new package name (in external/webkit/WebKit/android/jni
) and be recompiled without prelinking (make libwebcore
) and packaged with your application as a native library.
After everything is satisfied, you would then use your own WebView
class from your own package instead of the android.webkit
one. If you intend to replace android.webview
completely - you would have to recompile a framework.jar
and replace it inside system/framework/
(root privileges required).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…