Is it possible to manually edit settings.gradle file? - android

In a Cordova project, I have a file settings.gradle which looks like:
// GENERATED FILE - DO NOT EDIT
include ":"
include ":CordovaLib"
However, manually I want to edit the file and to make it look something like:
// GENERATED FILE - DO NOT EDIT
include ":"
include ":CordovaLib"
include 'manager-A'
project(':manager-A').projectDir = new File('libs/Manager-A')
include 'manager-B'
project(':manager-B').projectDir = new File('libs/Manager-B')
The above script looks good and it can be built successfully using Android studio. However, when I try to execute command line: cordova build android, it cannot be built.
The error is 'manager-A' and 'manager-B' that I manually included earlier cannot be found by the command line. After checking, it turned out that the file that I manually edited was re-generated and it becomes:
// GENERATED FILE - DO NOT EDIT
include ":"
include ":CordovaLib"
I'd like to ask whether it is possible to manually edit the file and that can be built as I explained above using the command line: cordova build android.
Any input is really appreciated!

Yes, I was looking to resolve same problem and found out following solution from this npm cordova-blinkup-plugin's Page. You can edit the settings with as:
1. Open path/to/project/platforms/android/cordova/lib/build.js
2. Edit fs.writeFileSync() function (line 273):
// Write the settings.gradle file.
fs.writeFileSync(path.join(projectPath, 'settings.gradle'),
'// GENERATED FILE - DO NOT EDIT\n' +
'include ":"\n' + settingsGradlePaths.join('') +
'include ":customProject1" +
'include ":customProject2"');
I hope this will help.
Update as suggested in another answer, In newer versions of Cordova you may get file at
/path/to/project/platforms/android/cordova/lib/builders/GradleBuilder.js

I found a better way to add custom include in setting.gradle file.
Make a file project.properties and add the below lines:
target=android-22
android.library.reference.1=CordovaLib
android.library.reference.2=manager-A
android.library.reference.3=manager-B
Now run cordova build android. This will make an entry in your setting.gradle file.
This answers part of the questions of how to include a module. But how to add the libs as below, still need a better way:
project(':manager-A').projectDir = new File('libs/Manager-A')
Can be done with modifying the build.js (Suggested by Sopheak Mongkul). I don't recommend, but it is good till you get a better solution.

An update to #ankibalyan's answer:
I found that function in path/to/project/platforms/android/cordova/lib/builders/GradleBuilder.js, just in case anybody needed it any more :)

Related

grapheneos build with custom bootanimation

i am trying to build grapheneos for pixel 6 with custom bootanimation
i created bootanimation.zip file according to instructions but can't figure out the location to put it in. since the usual location, system/media/bootanimation.zip is giving me an Error:
offending entries: system/media/bootanimation.zip
and the build fails.can anyone help me to understand what i am doing wrong ?
thank you
Here is correct answer:
For changing of animation for emulator x86_64 you need to replace
PRODUCT_COPY_FILES +=
device/generic/goldfish/data/media/test/swirl_136x144_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_136x144_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_132x130_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_132x130_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_130x132_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_130x132_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_144x136_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_144x136_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_128x128_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_128x128_mpeg4.mp4 \
to
PRODUCT_COPY_FILES +=
device/generic/goldfish/data/media/test/swirl_136x144_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_136x144_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_132x130_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_132x130_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_130x132_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_130x132_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_144x136_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_144x136_mpeg4.mp4
device/generic/goldfish/data/media/test/swirl_128x128_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_128x128_mpeg4.mp4
device/generic/goldfish/data/media/bootanimation.zip:$(PRODUCT_OUT)/product/media/bootanimation.zip
device/generic/goldfish/x86_64-vendor.mk
Your bootanimzation.zip needs to be in device/generic/goldfish/data/media
Please take a look here:
https://android.googlesource.com/platform/frameworks/base/+/master/cmds/bootanimation/BootAnimation.cpp
In case of Graphene it uses images from assets by default.
I didn't see your mk file and the output. But I'd suggested to overwrite some output files in your mk file and put your bootanimation to one from locations listed in BootAnimation.cpp via PRODUCT_COPY_FILES.
Something like here:
PRODUCT_COPY_FILES += \ packages/services/Car/car_product/car_ui_portrait/bootanimation/bootanimation.zip:system/media/bootanimation.zip

AOSP build missing libcryptfs

I'm trying to build AOSP for the oneplus one and I keep getting this error when tyring to make:
'out/target/product/bacon/obj/SHARED_LIBRARIES/libcryptfs_hw_intermediates/export_includes', needed by 'out/target/product/bacon/obj/EXECUTABLES/vold_intermediates/import_includes', missing and no known rule to make it.
I already added device/qcom/common and it has a cryptfs folder in it but it's not building it for some reason...
Any ideas?
In the Android.mk file of system/vold, add this:
device/qcom/common/cryptfs_hw
to the common_c_includes.
It not able to find the cryptfs path, so just add the path in your BoardConfig.mk
TARGET_CRYPTFS_HW_PATH := device/qcom/common/cryptfs_hw

Android/Cyanogenmod building: remove-project from roomservice.xml

I want to remove a device-related project from the roomservice.xml generated by brunching in CM and add a different repo myself.
Theoretically (in my localmanifest, called mint.xml), I should just need to
<remove-project name="Cyanogenmod/....
But repo sync tells me that
remove-project element specifies non-existant project
Is that because my local manifest is sourced before the roomservice.xml?
The question is a bit related to this one:
trouble-with-cyanogenmod-local-manifest
Additional sources:
CM Wiki about removing projects
Do you know how to source the own manifest after the roomservice.xml or somehow achieve the same?
Thanks for any answers.
As seen in Repo's manifest_xml.py,
LOCAL_MANIFESTS_DIR_NAME = 'local_manifests'
...
class XmlManifest(object):
...
def _Load(self):
...
local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME))
try:
for local_file in sorted(os.listdir(local_dir)):
if local_file.endswith('.xml'):
local = os.path.join(local_dir, local_file)
nodes.append(self._ParseManifestXml(local, self.repodir))
except OSError:
pass
local manifest files are read in alphabetical order. Your file mint.xml is therefore loaded before roomservice.xml, so at the time you try to remove the project that's defined in roomservice.xml it doesn't actually exist. Rename your file to something that sorts after roomservice.xml.

How to compile an AOSP project with my own custom bootanimation?

I'm trying to compile AOSP with a custom bootanimation, but with no success. And I just have run out of approaches... To change bootanimation, I've already done:
created a .zip file with the following structure:
bootanimation.zip {
desc.txt
part0 {
000.png, 001.png, ... ..., 010.png
}
part1 {
011.png, 012.png, ... ..., 021.png
}
}
edited permissions on system/core/include/private/android_filesystem_config.h
placed the bootanimation.zip file in /system/media/
However, when Android boots up, it just shows the Google trademark, skipping the boot animation. Can someone point what I'm missing?
PS: I'm successfully compiling AOSP. It boots up with all features ok. My problem is only with bootanimation customization on the compiled project.
Ok. I've solved my problem.
The issue was that besides all the things I've done, the bootanimation.zip file MUST be compressed with store method.
#mthama writes:
Ok. I've solved my problem. The issue was that besides all the things I've done, the bootanimation.zip file MUST be compressed with store method.
The solution is to not use any compression when packing the archive. This can be achieved on Linux with the following command:
zip -0r bootanimation.zip desc.txt part0 part1
The -0 option says to not use any compression and the -r option says to include contents of part0 and part1 recursively.
There are also ways doing this with a graphical interface, e.g. with 7-Zip as shown in this answer: https://superuser.com/a/337087/295453

search.h-No such file or directory while porting libtiff on Android-tiff 4.0.1

I am trying to port libtiff on Android. The source version I am using is tiff 4.0.1.
I am building this source inside u1 android OS.
I am getting the below error when I run mmm external/tiff 4.0.1/
In file included from external/tiff-4.0.1/libtiff/tiffiop.h:33,
from external/tiff-4.0.1/libtiff/tif_dirread.c:42:
external/tiff-4.0.1/libtiff/tif_config.h:93:1: warning: "HAVE_MALLOC_H" redefined
In file included from <command-line>:0:
./system/core/include/arch/linux-arm/AndroidConfig.h:221:1: warning: this is the location of the previous definition
In file included from external/tiff-4.0.1/libtiff/tif_dirread.c:42:
external/tiff-4.0.1/libtiff/tiffiop.h:54:21: error: search.h: No such file or directory
I tries searching a lot on internet but could not get the issue.
Can any one provide me just an approx idea what could be wrong or which package is missing.
I resolved this issue finally. I hope this will help someone who is doing this work in future. We just need to remove the lines from libtiff/tiffiop.h where header file is being referenced.That worked for me.
Depending on your libtiff version, you can also just undefine HAVE_SEARCH_H in the config file tif_config.h which will then no longer include <search.h>:
In tif_config.h:
#ifndef ANDROID
/* Define to 1 if you have the <search.h> header file. */
#define HAVE_SEARCH_H 1
#endif

Categories

Resources