[GUIDE] How to build Android on Windows

Search This thread

matssa

Senior Member
Jan 8, 2015
1,817
1,898
Dude stop the off topic please. This isn't the correct thread, open a new one on your xda device thread. And for info if you checked the lineage forums or even the envsetup.sh, you would have seen that you can specify a directory with repopick XXXXX -P Android/.....


Sent from my OnePlus5 using XDA Labs
 

Uldiniad

Senior Member
Mar 17, 2016
346
269
I fixed that by cherrypicking another commit for cm14.1
but now i got another errors
Code:
Starting build with ninja
ninja: Entering directory `.'
[  0% 8/48935] host Executable: conscrypt_generate_constants (/home/ins/ins-cm/out/host/linux-x86/obj/EXECUTABLES/conscrypt_generate_constants_intermediates/conscrypt_generate_constants)
[  0% 9/48935] Install: /home/ins/ins-cm/out/host/linux-x86/lib64/libssl-host.so
[  0% 10/48935] Generating TOC: /home/ins/ins-cm/out/target/common/obj/JAVA_LIBRARIES/core-oj_intermediates/classes.jar.toc
[  0% 11/48935] Yacc: aidl <= system/tools/aidl/aidl_language_y.yy
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/bison/bison -d  --defines=/home/ins/ins-cm/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.h -o /home/ins/ins-cm/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.cpp system/tools/aidl/aidl_language_y.yy"
/bin/bash: prebuilts/misc/linux-x86/bison/bison: cannot execute binary file: Exec format error
[  0% 11/48935] Notice file: system/tools/aidl/NOTICE -- /home/ins/ins-cm/out/host/windows-x86/obj/NOTICE_FILES/src//lib/libaidl-common.a.txt
[  0% 11/48935] Install: /home/ins/ins-cm/out/host/linux-x86/bin/conscrypt_generate_constants
[  0% 11/48935] host C++: libbase <= system/core/base/errors_unix.cpp
[  0% 11/48935] host C++: libbase <= system/core/base/test_utils.cpp
[  0% 11/48935] host C++: libbase <= system/core/base/strings.cpp
[  0% 11/48935] host Java: jarjar (/home/ins/ins-cm/out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes)
[  0% 11/48935] target Java: libphonenumber-platform (/home/ins/ins-cm/out/target/common/obj/JAVA_LIBRARIES/libphonenumber-platform_intermediates/classes)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/ins/ins-cm'

This thread is for lineage-15.1. Repopicking my commits will not work out of the box because they are only available on lineage-15.1. Your problem is that you're using the prebuilt 32-bit bison that causes crashes on wsl. You need to compile the 64-bit bison and set that one to be used by the build system. You can do that by backporting my commits to cm-14.1 on gerrit if you want. I personally am only planning on supporting the latest version available (currently lineage-15.1).
 

DeaDruiD

Member
Apr 30, 2007
25
6
Brno
If you search the thread for cpuinfo you'd find that someone else did have the same error and how they solved it

I DID read this whole thread and I did not find a solution. Unlike SaberShip I did not change standard paths to another drive or anything similar. Re-running the build again (without changing anything) worked this time, so it might be some intermittent issue.
 

Uldiniad

Senior Member
Mar 17, 2016
346
269
I DID read this whole thread and I did not find a solution. Unlike SaberShip I did not change standard paths to another drive or anything similar. Re-running the build again (without changing anything) worked this time, so it might be some intermittent issue.

I didn't know that you hadn't moved the path. The only cpuinfo related issue I had been made aware of was due to /mnt.
this is all issues reported on cpuinfo on wsl so far: https://github.com/Microsoft/WSL/issues?utf8=✓&q=is:issue+cpuinfo
it does look like it isn't working 100% like it would in native.
on another note, the rig you have will also make a difference.
Before my latest set of patches, I had noticed that some errors that showed up in some builds would not happen again when relaunching the build. As a rule of thumb it is good to try again and see if the error is frequent or consistent.
We are building on a system that is not designed to support android compilation after all.
 

ashitpatel

Senior Member
Jun 1, 2018
67
13
How much time or memory does repo sync require?

the repo sync command requires how much amount of data to be downloaded? its taking long time on my broadband connection.
 

nothinghf

Member
Jan 24, 2013
32
4
can anybody help me?

I do not have access to microsoft store

I need a link to download ubuntu 18.04 microsoft distro

I have these links for 14 and 16, but I can not find anything for 18
Code:
https://wsldownload.azureedge.net/14.04.5.3-server-cloudimg-amd64-root.tar.gz
https://wsldownload.azureedge.net/16.04.2-server-cloudimg-amd64-root.tar.gz

thanks for everything
 

shashank1320

Inactive Recognized Contributor
May 26, 2015
7,502
2,084
Delhi
can anybody help me?

I do not have access to microsoft store

I need a link to download ubuntu 18.04 microsoft distro

I have these links for 14 and 16, but I can not find anything for 18


thanks for everything
Create an outlook, hotmail or windows live account for US and acces Ms store.

---------- Post added at 04:43 PM ---------- Previous post was at 04:39 PM ----------

the repo sync command requires how much amount of data to be downloaded? its taking long time on my broadband connection.
It was around 15-16 GB in MM days when i built for Yureka. Don't think it will be less than 10 GB in any condition for repo
 
Last edited:
  • Like
Reactions: Uldiniad

eimanrasydan

Member
Jun 2, 2018
7
0
Don't have a product spec for: 'DEVICE NAME'

Hi. I try to build LOS 15.1 for my device (find7). And I encounter this problem when executing breakfast command:

including vendor/lineage/vendorsetup.sh
build/core/product_config.mk:238: *** Can not locate config makefile for product "lineage_find7". Stop.
Device find7 not found. Attempting to retrieve device repository from LineageOS Github (github/LineageOS).
Found repository: android_device_oppo_find7
Default revision: lineage-15.1
Checking branch info
Checking if device/oppo/find7 is fetched from android_device_oppo_find7
Adding dependency: LineageOS/android_device_oppo_find7 -> device/oppo/find7
Using default branch for android_device_oppo_find7
Syncing repository to retrieve project.
Fetching project LineageOS/android_device_oppo_find7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 1492, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 1492 (delta 0), reused 0 (delta 0), pack-reused 1490
Receiving objects: 100% (1492/1492), 446.93 KiB | 487.00 KiB/s, done.
Resolving deltas: 100% (780/780), done.
From github/LineageOS/android_device_oppo_find7
* [new branch] lineage-15.1 -> github/lineage-15.1
Fetching projects: 100% (1/1), done.

Repository synced!
Looking for dependencies in device/oppo/find7
Adding dependencies to manifest
Checking if device/oppo/msm8974-common is fetched from android_device_oppo_msm8974-common
Adding dependency: LineageOS/android_device_oppo_msm8974-common -> device/oppo/msm8974-common
Using default branch for android_device_oppo_msm8974-common
Checking if kernel/oppo/msm8974 is fetched from android_kernel_oppo_msm8974
Adding dependency: LineageOS/android_kernel_oppo_msm8974 -> kernel/oppo/msm8974
Using default branch for android_kernel_oppo_msm8974
Syncing dependencies
Fetching project LineageOS/android_kernel_oppo_msm8974
Fetching project LineageOS/android_device_oppo_msm8974-common
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 5406, done.
remote: Compressing objects: 100% (405/405), done.
remote: Counting objects: 2807209, done. | 613.00 KiB/s
remote: Compressing objects: 100% (5/5), done. KiB/s
remote: Total 5406 (delta 605), reused 1002 (delta 601), pack-reused 4394
Receiving objects: 100% (5406/5406), 2.24 MiB | 1.10 MiB/s, done.
Resolving deltas: 100% (3282/3282), done.
From github/LineageOS/android_device_oppo_msm8974-common
* [new branch] lineage-15.1 -> github/lineage-15.1
* [new tag] cm-11.0-XNPH05Q-bacon-5229c4ef56 -> cm-11.0-XNPH05Q-bacon-5229c4ef56
* [new tag] cm-11.0-XNPH25R-bacon-d22b777afa -> cm-11.0-XNPH25R-bacon-d22b777afa
* [new tag] cm-11.0-XNPH30O-bacon-4f280f505a -> cm-11.0-XNPH30O-bacon-4f280f505a
* [new tag] cm-11.0-XNPH33R-bacon-3628510d76 -> cm-11.0-XNPH33R-bacon-3628510d76
* [new tag] cm-11.0-XNPH44S-bacon-5fa8c79c0b -> cm-11.0-XNPH44S-bacon-5fa8c79c0b
remote: Total 2807209 (delta 5), reused 4 (delta 4), pack-reused 2807200 | 822.00 KiB/s
Receiving objects: 100% (2807209/2807209), 578.40 MiB | 1.82 MiB/s, done.
Resolving deltas: 100% (2360988/2360988), done.
From github/LineageOS/android_kernel_oppo_msm8974
* [new branch] lineage-15.1 -> github/lineage-15.1
Fetching projects: 100% (2/2), done.
Checking out files: 100% (226/226), done.
Checking out files: 100% (42266/42266), done.iles: 0% (168/42266)
Syncing work tree: 100% (2/2), done.

Looking for dependencies in device/oppo/msm8974-common
Adding dependencies to manifest
Checking if device/oppo/common is fetched from android_device_oppo_common
Adding dependency: LineageOS/android_device_oppo_common -> device/oppo/common
Using default branch for android_device_oppo_common
Syncing dependencies
Fetching project LineageOS/android_device_oppo_common
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 3469, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 3469 (delta 1), reused 3 (delta 1), pack-reused 3459
Receiving objects: 100% (3469/3469), 1004.87 KiB | 668.00 KiB/s, done.
Resolving deltas: 100% (1679/1679), done.
From github/LineageOS/android_device_oppo_common
* [new branch] lineage-15.1 -> github/lineage-15.1
* [new tag] cm-11.0-XNPH05Q-bacon-5229c4ef56 -> cm-11.0-XNPH05Q-bacon-5229c4ef56
* [new tag] cm-11.0-XNPH22R-bacon-03d77315ea -> cm-11.0-XNPH22R-bacon-03d77315ea
* [new tag] cm-11.0-XNPH25R-bacon-d22b777afa -> cm-11.0-XNPH25R-bacon-d22b777afa
* [new tag] cm-11.0-XNPH30O-bacon-4f280f505a -> cm-11.0-XNPH30O-bacon-4f280f505a
* [new tag] cm-11.0-XNPH33R-bacon-3628510d76 -> cm-11.0-XNPH33R-bacon-3628510d76
* [new tag] cm-11.0-XNPH44S-bacon-5fa8c79c0b -> cm-11.0-XNPH44S-bacon-5fa8c79c0b
Fetching projects: 100% (1/1), done.

Looking for dependencies in device/oppo/common
Adding dependencies to manifest
Checking if packages/resources/devicesettings is fetched from android_packages_resources_devicesettings
Adding dependency: LineageOS/android_packages_resources_devicesettings -> packages/resources/devicesettings
Using default branch for android_packages_resources_devicesettings
Syncing dependencies
Fetching project LineageOS/android_packages_resources_devicesettings
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 922, done.
remote: Total 922 (delta 0), reused 0 (delta 0), pack-reused 922
Receiving objects: 100% (922/922), 373.74 KiB | 359.00 KiB/s, done.
Resolving deltas: 100% (423/423), done.
From github/LineageOS/android_packages_resources_devicesettings
* [new branch] lineage-15.1 -> github/lineage-15.1
Fetching projects: 100% (1/1), done.
Checking out files: 100% (103/103), done.

Looking for dependencies in packages/resources/devicesettings
packages/resources/devicesettings has no additional dependencies.
Looking for dependencies in kernel/oppo/msm8974
kernel/oppo/msm8974 has no additional dependencies.
Done
build/core/product_config.mk:243: *** _nic.PRODUCTS.[[device/oppo/find7/lineage.mk]]: "vendor/oppo/msm8974-common/msm8974-common-vendor.mk" does not exist. Stop.
build/core/product_config.mk:243: *** _nic.PRODUCTS.[[device/oppo/find7/lineage.mk]]: "vendor/oppo/msm8974-common/msm8974-common-vendor.mk" does not exist. Stop.

** Don't have a product spec for: 'lineage_find7'
** Do you have the right repo manifest?

I have checked the device tree (github/LineageOS/android_device_oppo_find7/tree/lineage-15.1) and 15.1 do exist. What is causing this problem and how do I solve it?
 

Uldiniad

Senior Member
Mar 17, 2016
346
269
Hi. I try to build LOS 15.1 for my device (find7). And I encounter this problem when executing breakfast command:



I have checked the device tree (github/LineageOS/android_device_oppo_find7/tree/lineage-15.1) and 15.1 do exist. What is causing this problem and how do I solve it?

Sorry, it's my bad. You skipped a step but that's because I removed it by mistake from my guide the other day while editing it. I've added it back. Check step 8. And follow the rest as usual. :)
 

TheIronMaiden

Senior Member
Jul 30, 2013
1,138
541
Chicago
Samsung Galaxy S22 Ultra
Sorry, it's my bad. You skipped a step but that's because I removed it by mistake from my guide the other day while editing it. I've added it back. Check step 8. And follow the rest as usual. :)
I got to the last step, it was building for my device, and it said it had failed to load a boot animation, couldn't find it, but a zip has been created. I looked in the appropriate folder, couldn't find it. Alao I closed out the VM when I left for work, hoping it would save, so either way I'll be trying again tonight. Just wondering would a zip be created even thou it gave a failure for not finding a boot animation? I was building for the v20 h910, 14.1 just to get the hang of it , my first build lol
 

Uldiniad

Senior Member
Mar 17, 2016
346
269
I got to the last step, it was building for my device, and it said it had failed to load a boot animation, couldn't find it, but a zip has been created. I looked in the appropriate folder, couldn't find it. Alao I closed out the VM when I left for work, hoping it would save, so either way I'll be trying again tonight. Just wondering would a zip be created even thou it gave a failure for not finding a boot animation? I was building for the v20 h910, 14.1 just to get the hang of it , my first build lol

I don't have that device so I can't tell if the error is normal. It doesn't sound like it is a WSL build environment failure though. Sounds like the device tree upstream or locally has stuff missing. By VM do you mean WSL?
Some errors are fatal and will cause builds to crash. Others are not fatal and will allow the build to continue. Sounds like yours was part of the latter. It may be worth giving it a try (meaning flashing it on your phone) but that is up to you to consider the risks.
Do let me know what you get when you try building again tonight
 
  • Like
Reactions: TheIronMaiden

TheIronMaiden

Senior Member
Jul 30, 2013
1,138
541
Chicago
Samsung Galaxy S22 Ultra
I don't have that device so I can't tell if the error is normal. It doesn't sound like it is a WSL build environment failure though. Sounds like the device tree upstream or locally has stuff missing. By VM do you mean WSL?
Some errors are fatal and will cause builds to crash. Others are not fatal and will allow the build to continue. Sounds like yours was part of the latter. It may be worth giving it a try (meaning flashing it on your phone) but that is up to you to consider the risks.
Do let me know what you get when you try building again tonight
Its not, I couldn't get Ubuntu to work, so I used a preconfigured VM called "Builduntu" , I was leaving for work, and couldn't investigate. I checked a few folders. But it just now occurred to me that I needed to check the "out" folder, after rereading the guide. If it wasn't for you, though, I wouldn't have tried this. Thanks a lot dude
 

Uldiniad

Senior Member
Mar 17, 2016
346
269
Its not, I couldn't get Ubuntu to work, so I used a preconfigured VM called "Builduntu" , I was leaving for work, and couldn't investigate. I checked a few folders. But it just now occurred to me that I needed to check the "out" folder, after rereading the guide. If it wasn't for you, though, I wouldn't have tried this. Thanks a lot dude

Glad I was able to help. My focus is on WSL though, that is the build env I recommend for Windows 10 and it is the only thing I can help with. VMs are a different beast and dual-boot too.
 

eimanrasydan

Member
Jun 2, 2018
7
0
Sorry, it's my bad. You skipped a step but that's because I removed it by mistake from my guide the other day while editing it. I've added it back. Check step 8. And follow the rest as usual. :)

Hi. I tried your step and something came up when I tried to execute repo init.

eimanrasydan@DESKTOP-17LQC9L:~/android/lineage$ repo init -u github/LineageOS/android.git -b lineage-15.1
fatal: manifest 'default.xml' not available
fatal: no <manifest> in /home/eimanrasydan/android/lineage/.repo/local_manifests/roomservice.xml

and when I continued to the breakfast step, same problem occur. Hope you can help me on this.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    Useful resources




    https://github.com/MicrosoftDocs/WSL/issues/412#issuecomment-575923176
    12
    WSL 2.0 is OUT, build all the droids!

    Hi all,

    Microsoft just released the Windows 10 May 2020 update. But the bigger news is that it comes with WSL2. The TLDR of it is that Windows now has a Linux kernel bundled with it and that's game changing. And what that means for us is out of the box / seamless linux-like functionality for all teh things (goodbye Lineage hax patches for WSL1).

    I have updated OP https://xdaforums.com/showpost.php?p=75579631&postcount=1 and the useful resources post https://xdaforums.com/showpost.php?p=75579631&postcount=2 with the latest information I have so far. Note that with wsl2 using mnt is a readily available option and the wsl installation location can easily be changed as well :) Lots more flexibility

    Lastly, wanted to say thanks to all for your patience. I started this project while I was in the middle of university. I did this "for fun" with the goal of seeing if compiling Android on Windows (via WSL) would be remotely possible and if I personally would be able to pull that off. Apparently, I did :p. Part of this work (added with other work I did with Lineage) allowed me to get the Android job I currently have and I'm grateful for it.
    I know WSL 1 was a bit of a pain to work with and that headaches and frustration came from it. The good news, is those days are over. And the future is now.

    If you have questions that are not answered already in other posts, send them through. I will be randomly checking the thread. Although given that wsl2 doesn't need anywhere near as much maintenance as wsl1 I will probably be more hands off than I used to be (e.g. update the docs for newer versions of Android or Windows, etc.).

    Take care,
    Uldiniad
    11
    Pie (wsl flavour) is out of the oven

    Hey everyone,

    TL;DR
    It is now possible to build lineage-16.0 on wsl! Just follow the updated guide from start to finish (syncing 16.0 on top of 15.1 is not recommended) and enjoy.
    DO NOT COMPLAIN ABOUT ANY ERRORS THAT ARE NOT STRICTLY DUE TO THE BUILD ENVIRONMENT (WSL). Many devices are not ready to build yet!

    Also, as always, I recommend building on the latest version of Windows. October Update was released recently: https://www.microsoft.com/en-ca/software-download/windows10

    For those still insterested in building 15.1 (ignore the repopick step): https://web.archive.org/web/2018061...ng/guide-how-to-build-lineageos-15-1-t3750175 (as mentioned in my previous announcement, do not report any errors, I will ignore them, since I do not have the means to maintain more than one branch on wsl)

    Full version:
    It has been some time since the last update. I apologise for the crickets.
    I didn't want to write a post until I was able to guarantee I could build lineage-16.0 without issues on wsl. I downloaded the sources as soon as they were released but was unable to complete a full build for my device without cherry-picking lots of patches for it and decided against it since I wanted to reduce the scope of the errors to the build environment alone. I only recently thought of building a generic image instead (which would accomplish what I wanted). Thankfully, wsl had less problems this time cause Google were cool with updating their bison and flex prebuilts (thereby now making them 64-bit) and killed off ijar (hopefully forever). So only dex2oat needed a patch this time around :D
    The wsl-compile-lineage-16.0 patches are merged (https://review.lineageos.org/#/q/st...h:lineage-16.0+topic:wsl-compile-lineage-16.0). So no additional steps required there. Otherwise, make sure to install m4 since it spat out an error about it missing.

    Thank you for your support,

    Uldiniad

    P.S. Feel free to ask any questions related to this and check my previous announcements to know my goals and standards for this side-project (https://xdaforums.com/showpost.php?p=77321912&postcount=261 for example)
    P.P.S. I am working on making an official wiki page on the LineageOS website which will be more convenient than this thread. I might consider leaving the thread open for feedback once it is open, but I might also consider having feedback reported via official means (JIRA probably).
    6
    Want a piece of Pie?

    Hey everyone, got some news to share.

    As you may have heard, the Pie is now out of the oven. Given that,
    1. At the moment building android on WSL is 100% experimental
    2. There seems to be little to no interest from Google and Microsoft to officially support wsl as an android build environment
    3. I'm working alone with limited time and knowledge of both the android build environment and the inner workings of wsl
    4. I plan on supporting the latest version of lineage available
    I am therefore starting research and work on lineage-16.0 and will be leaving lineage-15.1 as it currently stands.
    As windows updates come, wsl will change and may bring new unforeseen errors to the oreo build environment. Since I will not be maintaing that branch anymore, it may mean that the best option to keep building 15.1 is to not update to the latest build of windows if it causes errors. Given this situation I will be paying less attention to bug reports for 15.1 as time goes by and 16.x takes its place (especially since I do not have 15.1 synced anymore and will not be able to reproduce errors).

    For 16.x, it entails I will proceed to ram my head into the wsl wall until it gives up or I do.

    Hoping we'll all get a piece of the Pie,

    Uldiniad