Adding and external platform library to AOSP - android-source

I'm trying to add an external library to my AOSP (v9.0.0-2.0.0) image by following the instructions provided with said library. The instructions are:
cd <aosp source folder>/external/libgpiod
mm
Then I run luch and then make to build the image then I flashed it to the SD card. But when I the library commands it via adb shell, none of them work. I get the response:
dart_mx8mm:/system/app # gpiodetect 0
/system/bin/sh: gpiodetect: not found
Although I can see that there are some files name the same as the library in the /out folder.
Is there any way to debug this? The log file isn't helping me very much.
The library in question is https://github.com/technexion-android/platform_external_libgpiod

Related

Where does `pub get` download pubspec dependencies to?

In javascript, we have NPM and the node_modules folder in every project. I was not able to find a similar concept for Dart/ Flutter, except the build folder in my app, which contains a folder of a few dependencies I have in pubspec.yaml. It doesn't have any of the source code though, and I think it's actually built from something else. I've also looked in /usr/local/flutter/packages which is where my flutter is installed, but it only shows flutter_driver, flutter_goldens, and more seemingly unrelated folders.
I guess if wanted to read the source code, I really need to find the repo and read from that, or is there a location for dependencies I haven't looked?
I even found projectDir/.dart_tool/pub, which didn't have any of my packages.
From the documentation:
Dependencies downloaded over the internet, such as those from Git and
the pub.dev site, are stored in a system-wide cache. This means that
if multiple packages use the same version of the same dependency, it
only needs to be downloaded and stored locally once.
By default, the system package cache is located in the .pub-cache
subdirectory of your home directory (on Mac and Linux), or in
%APPDATA%\Pub\Cache (on Windows; the location might vary depending on
the Windows version). You can configure the location of the cache by
setting the PUB_CACHE environment variable before running pub.
So for Mac and Linux for example, this would be ~/.pub-cache/hosted/pub.dartlang.org by default.
In Android Studio
I could directly view the source code of the package under `
[External Libraries/Dart Packages/Your Packages]
`
You can get pubspec downloaded from your flutter sdk location .
/flutter/.pub-cache/hosted/pub.dartlang.org/
You can also clone package git .
If you are running Windows as your OS, you can find the packages under the folder that you installed your Flutter SDK to when setting up Android Studio.
In my case - using Windows 10 - the path is as follows, where C:\ is my primary harddrive and flutter\ the folder containing the Flutter SDK...
C:\flutter\.pub-cache\hosted\pub.dartlang.org\english_words-4.0.0
The above path for instance points to the "english words package", containing the most ~5000 used English words and some utility functions, which are mentioned and used in the Flutter tutorial on their official page for writing and running your first Flutter app.
https://pub.dev/packages/english_words
If you have installed flutter using snap then the location might be
/home/user/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org
I had forgotten that I've been command + clicking into these libraries all the time in VSCode.
However, it looks like packages are not stored in the app folder. Packages that we use in our projects are downloaded to $FLUTTER_PATH/.pub-cache, so if I'm looking for camera picker plugin, its in
/usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5+2/lib/image_picker.dart
If you are using VScode you can find these dependencies under the dependencies window:

Aosp Download Issue

When i have downloaded android 10.0.0_r1 aosp code from the android source it took almost 150gb for the first time. Actually many said its about 50gb. Later i tried downloaded the android 4.0.0_r1 i have got just 20gb. but some folders got installed with bionic.git like that.There is no envsetup.sh file inside build.git folder and another issue was all files got downloaded in the platform folder not into my aosp folder which i set for download.can any one provide clear steps to download the source?

How to install android build support for unity manually (unity hub)?

I used Unity Hub downloaded latest Unity Editor, it works fine for editor,document and language packs, but can not download android build support. Just told me download failed many many times in the past two days.
So I downloaded UnitySetup-Android-Support-for-Editor-2018.2.16f1.pkg from webpage. This package install reported failed at the end of every try.This package size(348.9M) is not same as the one showed(365.8M) in UnityHub download list.
There is a 2017 version Unity Editor installed by download **.pkg, but the support installer never ask me about Editor's location.
Is there some way to install android build support manually?
Thanks for any tips.
This worked for me. To anyone facing this problem. I apologize for my long explanation and my english.
You can verify if *.pkg file is complete by comparing the checksum (I use dolphin)
Execute this command to manually install your UnitySetup-Android-Support-for-Editor-*.pkg
:~> ./UnitySetup-2019.1.0f2 -u --use-component-list
unity-2019.1.0f2-linux.ini --install-location $HOME/2019.1.6f1/ -d
$HOME
Note that the unity version must be compatible, otherwise you will have the error unable to initialize the Unity engine in you android device. I use:
UnitySetup-Android-Support-for-Editor-2019.1.6f1
Unity-2019.1.6f1
As much as possible use unity hub to install the android add-on, I use unity hub 2.0.1
Step by step explanation of the installation manually of *.pkg
The problem :(
I will put them in context.
I use opensuse tumbleweed. My problem was that I did not have android build support.
No Android module loaded image, and when I press open download page, the browser shows me a message:
<Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> Anonymous caller does not have storage.objects.get access to publishing-unity-binaries-prd/6e9a27477296/Unknown/UnitySetup-Android-Support-for-Editor-2018.3.0f2. </Details> </Error>
and I can not do anything else.
The SOLUTION :)
0.- Previous requirements
I already had my previous installation this file:
UnitySetup-2019.1.0f2
1.- Download UnitySetup-Android-Support-for-Editor-2019.1.x.pkg
To achieve this look for UnitySetup-Android-Support-for-Editor- in the file https://public-cdn.cloud.unity3d.com/hub/prod/releases-linux.json
This is a fragment of release-linux.json file
...
{
"id": "android",
"name": "Android Build Support",
"description": "Allows building your Unity projects for the Android platform",
"downloadUrl": "h ttps://download.unity3d.com/download_unity/f2970305fe1c/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2019.1.6f1.pkg",
"category": "Platforms",
"installedSize": 1958542000,
"downloadSize": 664332318,
"visible": true,
"selected": false,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer",
"checksum": "d00addecefb7babcb9cd6a8085672908"
}
...
What interests us about this file is the url to download https://download.unity3d.com/download_unity/f2970305fe1c/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2019.1.6f1.pkg and the checksum.
2.- Component list file
Download the file from the list of components from here or create a file like unity-2019.1.0f2-linux.ini:
[Android]
title=Android Build Support
description=Allows building your Unity projects for the Android platform
url=MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2019.1.6f1.pkg
md5=d00addecefb7babcb9cd6a8085672908
install=true
mandatory=false
size=365578263
installedsize=1259081000
requires_unity=false
for [Android] install=true, the url and md5 which is the checksum from the previous step (or again I get md5 with dolphin to verify)
3.- Installation
Have the following files in the same directory that in my case are in $HOME
UnitySetup-2019.1.0f2
UnitySetup-Android-Support-for-Editor-2019.1.6f1.pkg
unity-2019.1.0f2-linux.ini
Finally, execute the following command line. (Note that my current unity installation is in $HOME/2019.1.6f1/).
:~> ./UnitySetup-2019.1.0f2 -u --use-component-list unity-2019.1.0f2-linux.ini --install-location $HOME/Unity-2019.1.6f1/ -d $HOME
Thanks
Source
https://forum.unity.com/threads/installing-android-build-support-and-other-build-support-post-installation.515436/
https://forum.unity.com/threads/how-to-install-editor-packages.554977/
Download the Android Sdk Manager under Command line tools only.
And download the SDK you need, then link it to Unity.
I usually download AndroidStudio and it comes with a GUI manager.
Here is some more info about how to update sdk tools.
You link it here: Edit/Preferences/External Tools
According to this:
Possible causes could be:
A corrupt package (download again manually from the list of individual
packages)
Filesystem corruption (repair disk from single-user mode, reboot and
try again)
The user account somehow not being in the sudoers group (deeper
technical problem - check Apple's forums)
Package file stored on a drive formatted weirdly, so execute
permissions aren't set correctly (pre-/post-installation script won't
run; move to boot drive)
Add Unity modules on Linux manually:
Download pkg:
Head to this page, select your specific unity version from the dropdown at the right.
For those modules that arent listed in linux section, download the pkg from the mac section.
Extract the pkg. you can use any of these:
Files
Archive Manager
7z x -o* UnitySetup-XXXXXX-Support-for-Editor-2022.1.16f1.pkg
bsdtar -xf UnitySetup-XXXXXX-Support-for-Editor-2022.1.16f1.pkg TargetSupport.pkg.tmp/Payload
Move the extracted "Payload" file to one of these directories:
For Android Build Support:
{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer
For Windows Build Support (Mono) & Widows Dedicated Server Build Support:
{UNITY_PATH}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport
For Mac Build Support (Mono) & Mac Dedicated Server Build Support:
{UNITY_PATH}/Editor/Data/PlaybackEngines/MacStandaloneSupport
4. Now decompress and extract Payload:
zcat Payload | cpio -iu && rm Payload
or if it's named Payload~ just extract it:
cpio -iu < Payload~ && rm Payload~

emulator: ERROR: There is no user data image in your build directory. Please make a full build

I'm doing android open source project and I'm new to aosp.
I am building gingerbread in Ubuntu 14.04 64-bit.
I have managed to successfully compile the source code without any error, and now when I run the command 'emulator', I get the following error and my emulator is not running at all
emulator: WARNING: ignoring locked user data image at /home/hari/Android/aosp/out/target/product/generic/userdata-qemu.img
emulator: WARNING: Another emulator is running. user data changes will *NOT* be saved
emulator: ERROR: There is no user data image in your build directory. Please make a full build
I searched over the internet and was not able to find a guy with the similar problem. So, anyone have any idea? What could be the possible solution ?
Edit:
My out directory and userdata-qemu.img is locked! Is this unusual ??
Thanks in advance.
I think your file is locked... may be you copied some files from another user. Make sure you give the all your files some permissions.
cd one step back from your aosp root directory and use this command
chmod -Rv 755 youraospdirectory/
I had similar issues, but in my case the whole directory was the problem.
So it would be better to chmod the whole directory.

How to add external java library to custom Android framework?

Can someone enlighten me on how to include an external java framework to android framework and compile it as a part of the custom android framework?
The idea is to make this external framework a part of my custom android framework and expose it as android service for other processes to use.
In essence what I did is -
checked for android port of the java framework
Copied the src dir (including all the external jar files) from the ported framework to framework/base/core/java/android/
Edited ActivityManager in the framework to call the copied library
run make
Is this the right approach to edit Android framework? Since, I am including the java files and associated external jars of the external project inside the Android framework I suspect make fails while converting the jars to dex.
Can somebody point me towards any available resources dealing with Android Framework internals and on how to edit Android framework?
I checked the Tutorial: Android Internals - Building a Custom ROM, Pt. 2 of 2 on youtube from this year's Marko Gargenta presentation in Beijing, China. But he didn't make it (i.e. adding external framework or jars) clear either.
First: I'm not very experienced in the Android build process, so there might be a better solution, but this one should work (at least for Android 2.2).
I assume, that you use Eclipse for the source code modification and already executed a successful make -j4...
Create a new source folder: external/<your-library>/src
Copy all Java source files into this folder.
Open the following make file: <android>/frameworks/base/Android.mk
Search for # Build ext.jar and add your library as follows:
[...]
ext_dirs := \
../../external/apache-http/src \
../../external/<your-library>/src \
../../external/gdata/src \
../../external/protobuf/src \
../../external/tagsoup/src
[...]
Now you should be able to access these libraries from the Android framework...
Finally execute make -j4 ext to build only the external module,
Or make -j4 to build all changed files (if a previous build exists in /out/).
README.txt from git repo in https://android.googlesource.com/platform/vendor/sample is a good example howto do it. It's good to clone it to see the examples.
Basically you need to create jar file and add it in filesystem, add xml configuration into /system/etc/permissions/ and declare <uses-library> in apk's AndroidManifest.xml.
In my case I had problem with adding <uses-library> on a wrong place (not in <application>).
So it's good to check the result with:
$ aapt dump badging Foo.apk | grep uses-library
uses-library:'android.foo'