Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building framework.jar in AOSP

I am trying to build a framework.jar from android-x86 aosp but 'mm' in /frameworks/base return "No such file or directory". And also I tried "make framework" but after that framework.jar size in out 300 bytes. I tried "make modules" to get framework module name but list so long. May be somebody know what module name for build complete framework.jar ?

Update: I don't know why mm and mmm don't work for me, but I understand thats "make framework" work correctly, after android 5.0 java classes compiling in ART .oat and .odex files. But I try to reverse emulator framework.jar that have framework.jar fro dalvik with .dex files inside. And it confused me when I compared the builded and emulator file.

like image 362
S__ Avatar asked Nov 14 '25 20:11

S__


2 Answers

Firstly, you should have these in your ~/.bashrc when, and do a full build/flash. Otherwise making and building just parts of framework will cause the device to not boot. These will cause the first boot to be a tad slower since the pre-optimizations are not done at build time.

export WITH_DEXPREOPT=false 
export DISABLE_DEXPREOPT=true
export DEX_PREOPT_DEFAULT=nostripping

Next build, you can run just

source build/setupenv.sh 
lunch XXXXX-userdebug 
make framework

And to update on device

adb root
adb remount
adb sync
adb reboot
like image 168
Rick Sanchez Avatar answered Nov 17 '25 11:11

Rick Sanchez


For anyone looking at this in 2023 for Android 13 (API 33), to build framework.jar, follow this instead:

make framework-minus-apex

Ref: frameworks/base/Android.bp

Secondly, IMHO, to access any custom APIs in application side, the best way is to create a JAR from the required Manager classes and import in Android Studio as a dependency instead of adding a bulky framework.jar

like image 39
Rajat Gupta Avatar answered Nov 17 '25 12:11

Rajat Gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!