How to add Room,Lifecycle,Paging libraries in Android.mk ( AOSP build) - android-source

I created an application with Room,Lifecycle,Paging libraries in android studio,its working well.
Then I tried to build the same application in AOSP,But I can't include Room,Lifecycle,Paging libraries.
I found all these libraries in frameworks/support/ .
But i don't have any idea about how to add these libraries.
Any clues on how to do it?

Add the following lines in your Android.mk file
LOCAL_STATIC_ANDROID_LIBRARIES += \
android-arch-room-runtime \
android-arch-paging-runtime \

Related

Flutter Intl - multi module translations with synthetic-package enabled

I have app that has 3 modules - Admin/Guest/Common
I'd like to have arb translations in every module separately.
I managed to do this with some help from answers here, but if admin is my main module, and I'm importing common in pubspec like that:
dependencies:
common:
path: ../common/
Translations from common are not automatically created using syntethic-package.
I have to run command inside common directory and generate those files and rerun this on every change in arb files.
fvm flutter gen-l10n \
--arb-dir translations \
--template-arb-file common_en.arb \
--output-localization-file common_localizations.dart \
--output-class CommonLocalizations \
--output-dir lib/translations \
--no-synthetic-package
Is there a way to enable Intl library to no use no-synthetic-package in this case?

Installing library into yocto rootfs

I am working on yocto i have compiled a library using yocto, which installed library inside
/tmp/work/corei7-64-poky-linux/lib-ad/git-r0/package/usr/lib/libad.a
Now inside my recipe i have included
FILES_${PN} += " \
libad.a \
"
Now this is adding this file into build-corei7-64/tmp/sysroots/corei7-64/usr/lib/libad.a
but not into final rootfs, I assume FILES_${PN} will copy my files into rootfs.
but this is not happening.
Any help is appreciated, Thank You
Well, up to now you managed to build and package your code correctly.
I guess you mean with rootfs the image that you build. To add a package to an image you can set IMAGE_INSTALL_append = "lib-ad" within your local conf

How do I link a static lib to a yocto autotools project in Eclipse

I have created a Yocto autotools project in Eclipse (based on a Hello World project).
I wanted to separate my code into a number of libs and then link them in a form of static libs (.a) to my project.
Now I have one app and a number of static libs. However, no matter what I try I can't get my code to compile. Each separate lib compiles and produces a .a file, but my app doesn't.
After searching the web I have a possible solution - add a direct link to my static libs:
MyApp_CPPFLAGS="-I$LOCATION"
MyApp_LDADD="/home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a"
This is my Makefile.am file, where libEncoding2.a exist in that path.
The error I get is:
make[2]: *** No rule to make target `"/home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a"', needed by `MyApp'. Stop.
I already built the lib so I am not sure why a make try is even needed.
Any help will be appreciated.
Because you use static library in your recipes, you can make a soft link to the library in your project source folder, i.e., hello-world-0.1, using following command to link to your static library
ln -s /home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a
and then edit your bb file, hello-world_0.1.bb, adding the source path to your URL
SRC_URI = " \
file://libEncoding2.a \
file://hello-world.c \
"
and in the do_compile block, using follow command to compile your project
do_compile() {
${CC} hello-world.c libEncoding.a -o hello-world
}
do_install() {
install -d ${D}${bindir}/Hello
install -m 0755 enet ${D}${bindir}/Hello
}
After you bitbake your project
bitbake hello-world
and run mkefidisk.sh, you can find the hello-world in /usr/bin/Hello/hello-world. Hope this hint can help you.
BTW, I am not familiar with autotools, I just use make to bitbake the recipes. And your static library should also be created in Yocto not in Eclipse I think. So I think your path for the static library maybe not correct, it should locate in ~/yocto/build/tmp/... or some where like this. In my case, it was located in ln -s ~/yocto/build/tmp/sysroots/intel-corei7-64/usr/lib/libEncoding.a depends on your target environment.
Depending on whether you're using libtool or not, you should have either a noinst_LTLIBRARIES or noinst_LIBRARIES list of targets, respectively. This should only include the name of your library (libEncoding2.la or libEncoding2.a.)
You should never use a full path for this, and you should not quote Make variables, so what you were looking for is
MyApp_CPPFLAGS = -I$LOCATION
MyApp_LDADD = libEncoding2.la # or .a
And that would work.
But on the other hand it seems like you should take some time to understand how autotools work, as it might not be what you're looking for. With a grain of salt you can take my Autotools Mythbuster as a starting point.

Bitbake does not populate so symlinks to shared libaries

In my Yocto layer I have such bitbake recipe for Qt Gstreamer libraries:
SUMMARY = "QtGStreamer libraries for Qt5"
DESCRIPTION = "QtGStreamer is a set of libraries and plugins providing C++ bindings for GStreamer with a Qt-style API plus some helper classes for integrating GStreamer better in Qt applications."
SECTION = "multimedia"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
SRC_URI[md5sum] = "fd794045a828c184acc1794b08a463fd"
SRC_URI[sha256sum] = "9f3b492b74cad9be918e4c4db96df48dab9c012f2ae5667f438b64a4d92e8fd4"
SRC_URI = "http://gstreamer.freedesktop.org/src/qt-gstreamer/${PN}-${PV}.tar.xz"
RDEPENDS_${PN} = "libgstpbutils-1.0 \
gstreamer1.0 \
qtdeclarative \
glib-2.0 \
libgstvideo-1.0 \
libgstapp-1.0 \
libgstaudio-1.0 \
qtbase \
"
inherit cmake_qt5
export EXTRA_OECMAKE = "-DQT_VERSION=5 \
-DHW_PLATFORM=imx6 \
-DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_DIR_NATIVE}/usr/bin/qt5/ \
-DUSE_QT_PLUGIN_DIR=OFF \
-DCMAKE_SKIP_INSTALL_RPATH=YES \
-DCMAKE_SKIP_RPATH=YES \
-DCMAKE_INSTALL_PREFIX="/" \
"
FILES_${PN} += "\
${libdir}/gstreamer-1.0/* \
"
INSANE_SKIP_qt-gstreamer = "installed-vs-shipped"
EXTRA_OECONF += "--disable-rpath"
As a result of this recipe in temporary build directory I have 3 files for each shared library created- one actual library and two symlinks like so:
libQt5GStreamer-1.0.so -> libQt5GStreamer-1.0.so.0
libQt5GStreamer-1.0.so.0 -> libQt5GStreamer-1.0.so.1.2.0
libQt5GStreamer-1.0.so.1.2.0
Now I wonder why in package ${PN} I have files libQt5GStreamer-1.0.so.0 and libQt5GStreamer-1.0.so.1.2.0 but no libQt5GStreamer-1.0.so ?
On the other hand I have this file included in package ${PN}-dev.
I tried to copy this file to package ${PN} by using FILES_${PN} but then I get QA error that I cannot have so symlinks in non-dev package.
My Qt application to play video depends on these *.so files so I need to have them on my target rootfs.
How to add those file to the image?
My Qt application to play video depends on these *.so
This is probably the problem you should be solving: the .so should not be needed by the application at runtime. The way Yocto installs libraries and symlinks is quite standard: You will find this same division in Ubuntu and other distros.
You can silence the QA warning with INSANE_SKIP_${PN} += "dev-so" but that won't change the fact that the bug is probably in the application.
Alternatively you could of course make your application depend on the -dev package.

Eclipse PDE headless builds modifies source dirs and MANIFEST.MF

The problem
From a number of OSGi bundles, I am creating a p2 update site using the PDE headless feature build. I don't want to copy the entire source tree (if it can be avoided) so I point the buildDirectory property to the location of my sources.
The general problem I encounter is that the PDE build sprinkles build artifacts all over the source directory (and not like all other decent build tools where the build artifacts are stored to a separate location like e.g. Maven's target folder). I can live with this but more annoying is that the PDE build modifies the MANIFEST.MF file of each compiled bundle.
The only real change to the MANIFEST.MF file is that
Bundle-Version: 1.0.0.qualifier
is rewritten to
Bundle-Version: 1.0.0.<yyyyMMddhhmm>
Apart from that, the entire file is reformatted. Of course it is correct to rewrite the file to what should end up in the assembled jars but the modified manifest should IMHO not overwrite the source manifest.
A possible solution?
Does anybody know if there is a way to tell PDE headless build to send all build artifacts to a location separate from the source files?
The nitty gritty details...
Please find below the details about my build.
How I call PDE headless
This is the command I use to call PDE headless build:
java \
-jar \
<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar \
-application \
org.eclipse.ant.core.antRunner \
-buildfile \
<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.pde.build_3.8.1.v20120725-202643/scripts/build.xml \
-data \
<prefix>/target/pde_workspace \
-Dbuilder=<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.pde.build_3.8.1.v20120725-202643/templates/headless-build \
-DtopLevelElementId=org.example.myproject.feature \
-DtopLevelElementType=feature \
-DbuildDirectory=<prefix>/source \
-DbaseLocation=<prefix>/targetPlatform \
-DjavacSource=1.7 \
-DjavacTarget=1.7 \
-DcompilerArg=-g \
-DbuildLabel=output \
-DarchivePrefix=org.example.myproject \
-DbuildId=org.example.myproject.feature \
-DarchivesFormat=*,*,* - folder \
-Dp2.gathering=true \
-Dp2.build.repo=<prefix>/target/update-site \
-DskipMirroring=true \
-DcollectingFolder=<prefix>/target/tmp
My hope was that adding -DcollectingFolder would redirect all build artifacts to this folder, but it is left empty.
PDE headless documentation
The documentation for PDE headless builds is comprehensive yet somewhat imprecise. For example, for one of its many options it says:
buildType: Type of build, normally something like I, N, M, etc.
The documentation I have been able to find is this:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Freference%2Fpde_builder_config.htm
Does anyone know of other documentation of the PDE headless builds?
You want to set the properties buildTempFolder and feature.temp.folder. I don't believe that these properties are documented anywhere.
If you are familiar with ant, the way to discover this would be to look at the build.xml file that gets generated for a plugin. In the <init> target, if buildTempFolder is set, then the build will end up setting something like
build.result.folder=${buildTempFolder}/plugins/org.example.plugin_1.2.3.201411110853`
If buildTempFolder is not set, then the default value is ${basedir}, which is the root folder of the plugin.
This build.result.folder will be the destination for most of the compiled .class files (see the <#dot> target), and the manifest will be copied there before it is modified (see the <publish.bin.parts> target. If you use customBuildCallbacks, then everything will be staged here before calling your custom callbacks.
The feature.temp.folder is similar to the buildTempFolder but affects features instead of plugins.