ungoogled-software / ungoogled-chromium-android

Android build for ungoogled-chromium
GNU General Public License v3.0
491 stars 43 forks source link

Weird android studio project structure. Could not make it work #101

Closed marzuagacds closed 3 years ago

marzuagacds commented 3 years ago

*Device info (please complete the following information):

*Is the bug related to extensions? No

*If not related to extensions, can the bug be reproduced with corresponding Chromium version? Yes

*Describe the bug After downloading and generating the android project and open it with android studio is has a weird structure, with a lot of modules or packages (depending on if --split-projects param was used) I'm not able to run the project or generate an apk Its showing dependency errors/overlap between some of the packages/modules

*To Reproduce Follow the instructions to download and fetch/build the project using both the instructions of ungoogled-chromium-android and the ones of the oficial chromium https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/android_build_instructions.md and https://chromium.googlesource.com/chromium/src/+/HEAD/docs/android_studio.md The last command was: build/android/gradle/generate_gradle.py --output-directory out/Default --project-dir out/Debug --target '//chrome/android:chrome_public_apk' And after that just open the project located in out/Debug/gradle with Android Studio

(this is also happening when trying with the base chromium project)

*Expected behavior A clear and concise description of what you expected to happen.

Screenshots Please see the screensho, it shows the project structure

Additional context I have been struggling with this for the last couple of weeks. My client is willing to pay for support in order to have a working base project both for android and iOS (I'm just working on the android side now). So if you know how to make this work and have a basic understanding on how the chromium project works (ej: knowing how to apply security patches from this project onto our forked project) please reach out to me at marzuaga@codigodelsur.com.

wchen342 commented 3 years ago

This is expected. Chromium cannot be generated with Android Studio and it does not support Gradle. The only way to build chromium is using GN and ninja as explained in android_build_instructions. The android studio project generated can help you with code analysis with IDE, but you cannot build with it.

marzuagacds commented 3 years ago

Hi @wchen342 ! First of all thanks for the quick response! 😃 We are really struggling here trying to understand chromium.

So, just to confirm, there is no way to work in Android Studio and then use GN or ninja to build chromium with the changes we made?

Do you have any experience working on top of chromium or ungoogled-chromium to build a custom browser (ideally for android and/or iOS)?

We have other questions we would like to know the answers to, do you know someone who could help us or at least have a quick call to explain the basics of chromium to us? This of course would be a paid support

wchen342 commented 3 years ago

there is no way to work in Android Studio and then use GN or ninja to build chromium with the changes we made?

What I meant was that you cannot build in Android Studio directly. But of course you can, e.g. use Android Studio to modify codes (they are just text files on your file system, and Android Studio is just an editor like Notepad or Vim). And after you modified the codes you need to build with ninja manually.

do you know someone who could help us or at least have a quick call to explain the basics of chromium to us? This of course would be a paid support

I cannot speak on behalf of others, but you can find a list of chromium-based browsers + kiwi browser, including open and close sourced ones that you can try to contact.

marzuagacds commented 3 years ago

Ok, I understand. Thanks for the info!

I cannot speak on behalf of others, but you can find a list of chromium-based browsers + kiwi browser, including open and close sourced ones that you can try to contact.

Would you be interested in helping us a bit understand more about how chromium works and maybe figure out which path we should follow in order to build our custom browser? If so, please reach me out at marzuaga@codigodelsur.com My client is willing to pay, so feel free to set the rate/fee in whatever amount you feel comfortable Even a call of 1 or 2 hours we feel would be very helpful for us

What I meant was that you cannot build in Android Studio directly. But of course you can, e.g. use Android Studio to modify codes (they are just text files on your file system, and Android Studio is just an editor like Notepad or Vim). And after you modified the codes you need to build with ninja manually.

What I think would be ideal for us is to have some project that can compile on android studio, like this one: https://github.com/jhonatasrm/chromium-android You can clone that repository and open it with Android Studio and it will compile and run on an android device, it installs chromium for android. Do you know how to get from the sources to a project like that? Maybe that is something that is not recommended for some reason?

Thanks again!

wchen342 commented 3 years ago

Would you be interested in helping us a bit understand more about how chromium works and maybe figure out which path we should follow in order to build our custom browser? If so, please reach me out at marzuaga@codigodelsur.com

Unfortunate I cannot. I work for one of the browser vendors and doing so will violate contract.

What I think would be ideal for us is to have some project that can compile on android studio, like this one:

That will require some extensive modifications to some parts of the source codes I think. I am not exactly sure how much work will that be, but I assume it won't be trivial. However when you build with ninja, you will get a script inside your output folder which you can run to generated bundle on device quickly. For example, if you run ninja -C out chrome_modern_public_bundle, then under out/bin you will find a script named chrome_modern_public_bundle, and you can connect a device to you pc and run ./chrome_modern_public_bundle run to automatically install, run and show logcat for the new build. So assuming the build will be successful, you can combine those two commands into one, and that will give you the same effect as clicking a button in Android Studio, just you need to use command line instead.