Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is android.jar ? What does it include?

Tags:

android

I am a noob with android development. What is android.jar? I am referring to https://developer.android.com/guide/platform/?nav=true and trying to understand which layer it fits into. I heard conflicting opinions and am now really confused, considering my limited knowledge in Android. Thanks!

like image 819
2.8a8a_G Avatar asked Mar 07 '23 05:03

2.8a8a_G


1 Answers

there are 2 android.jar:

The first one is the android.jar in the computer. This is a JAR file. It is provided by gradle in the classpath. It contain the Android framework classes. It does not contain the Android framework code but only stubs for the type signatures, methods, types, etc. The android.jar JAR file is only used for the Java compiler before deployment on an Android device. It is not bundled with your application. By default, all calls to the provided Android.jar throw exceptions, this allows you to write tests that do not depend on any Android platform behavior.

Once you application is deployed on the device it will use the android.jar JAR file on the Android device (The second one). I couldn't find any source that said android.jar is here. I think android.jar fit better in the "Java API Framework" layer.

Sources:

https://codelabs.developers.google.com/codelabs/android-testing/index.html?index=..%2F..android-training#5

https://www.cnblogs.com/larack/p/4501078.html

like image 120
moralejaSinCuentoNiProverbio Avatar answered Mar 21 '23 04:03

moralejaSinCuentoNiProverbio