Showing posts with label Microsoft Visual Studio. Show all posts
Showing posts with label Microsoft Visual Studio. Show all posts

29 October, 2025

Building Android from Source (AOSP 15) on Lenovo ThinkBook 16p G5 IRX

🚀 Building Android from Source (AOSP 15) on Lenovo ThinkBook 16p G5 IRX

Author: Porfy Vidal
Platform: Ubuntu 22.04 LTS
Target: AOSP 15 (Vanilla Ice Cream, Cuttlefish Emulator)


🧩 1. System Overview

After multiple rebuilds and optimizations, this guide shows the complete setup for a working AOSP 15 development environment on the Lenovo ThinkBook 16p G5 IRX with Ubuntu 22.04.

Key goals:

  • Compile AOSP 15 from source
  • Run Cuttlefish emulator (x86_64 phone)
  • Enable ADB access and app installation
  • Automate system maintenance tasks

⚙️ 2. Preparing Ubuntu 22.04

Install the essentials and developer tools:

sudo apt update && sudo apt install -y \

  openjdk-17-jdk python3 git-core gnupg flex bison gperf build-essential \

  zip curl zlib1g-dev libc6-dev libncurses5-dev libncurses5 \

  x11proto-core-dev libx11-dev libgl1-mesa-dev libxml2-utils xsltproc unzip \

  fontconfig repo ccache

Optional (but useful) developer tools:

sudo apt install -y htop nvtop iotop baobab gnome-disk-utility gparted \

  vim nano gnome-tweaks filezilla qbittorrent chrome-gnome-shell


🧰 3. Set Up the AOSP Source Tree

mkdir ~/aosp15

cd ~/aosp15

repo init -u https://android.googlesource.com/platform/manifest -b aosp-main

To sync specific components only (faster iteration):

repo sync -j1 --fail-fast external/ComputeLibrary external/apache-harmony \

external/aws-sdk-java-v2 prebuilts/remoteexecution-client prebuilts/tools

Expected output:

repo sync has finished successfully.


🧱 4. Build Configuration

cd ~/aosp15

source build/envsetup.sh

Choose the target build:

lunch aosp_cf_x86_64_phone-trunk_staging-userdebug


🖥️ 5. Installing Cuttlefish Emulator Packages

Download the following from the official AOSP Cuttlefish build server:

cvd-host_package.tar.gz

aosp_cf_x86_64_only_phone-img-14253210.zip

Extract them:

mkdir ~/cuttlefish

tar -xzf ~/Downloads/cvd-host_package.tar.gz -C ~/cuttlefish

unzip ~/Downloads/aosp_cf_x86_64_only_phone-img-14253210.zip -d ~/cuttlefish

Verify images exist:

ls ~/cuttlefish | grep img

You should see:

boot.img

init_boot.img

super.img

userdata.img

vendor_boot.img

...


🧪 6. Launching the Emulator

cd ~/cuttlefish/bin

./launch_cvd

Once launched, check ADB connectivity:

adb devices

Expected:

List of devices attached

0.0.0.0:6520	device

Open an interactive shell:

adb shell


📦 7. Installing Apps via ADB

To install an APK:

adb install MyApp.apk

For .xapk packages:

  1. Unzip the .xapk.
  2. Find the contained .apk file.
  3. Install it:
adb install app.apk


🧼 8. System Maintenance Automation

Create /usr/local/bin/sysrefresh to automate updates and cleanup:

#!/bin/bash

echo "============================================="

echo "🕒 System refresh started at: $(date)"

echo "============================================="



echo "🔄 Checking for package updates..."

UPDATES=$(apt list --upgradable 2>/dev/null | grep -v Listing | wc -l)

if [ "$UPDATES" -eq 0 ]; then

  echo "☑️  No updates were needed. System is already up to date."

else

  echo "🛠️  Installing updates..."

  sudo apt update && sudo apt upgrade -y

fi



echo "🧹 Performing cleanup..."

sudo apt autoremove -y

sudo apt autoclean -y



echo "🧠 Disk space usage summary:"

df -h | grep -E '^/dev/nvme|Filesystem'

echo "---------------------------------------------"

echo "✅ Last refresh completed: $(date)"

echo "---------------------------------------------"

echo "🟢 sysrefresh complete."

Make it executable:

sudo chmod +x /usr/local/bin/sysrefresh

Run it any time:

sysrefresh


🖥️ 9. Display Configuration

Switching to Xorg restored full dual-monitor support.

Current setup:

  • Internal display: eDP-1 (3200×2000)
  • External monitor: HDMI-1-0 (3840×2160)

Dual display:

xrandr --output eDP-1 --primary --mode 3200x2000 --pos 0x0

xrandr --output HDMI-1-0 --mode 3840x2160 --right-of eDP-1 --scale 0.5x0.5

External only:

xrandr --output eDP-1 --off --output HDMI-1-0 --auto

Internal only:

xrandr --output HDMI-1-0 --off --output eDP-1 --auto


🧩 10. Summary of Achievements

  • ✅ AOSP 15 environment successfully built
  • ✅ Cuttlefish emulator running smoothly
  • ✅ ADB functional for app install and testing
  • ✅ Automated maintenance script (sysrefresh)
  • ✅ Dual-display working under Xorg
  • ✅ Optimized Ubuntu 22.04 for development

💡 Final Thoughts

This setup transforms the ThinkBook 16p G5 IRX into a powerful Android development workstation. While the process takes patience, once configured, the environment is stable and production-ready.

“Building Android from source isn’t just about compiling code — it’s about understanding the entire ecosystem.”


Guidance provided with the help of ChatGPT (OpenAI) 

Till then!

22 November, 2019

Cannot sign in to Visual Studio 2019

We could not refresh the credentials for the account. The browser-based authentication dialog failed to complete. Reason: The protocol is not known and no pluggable protocols have been entered that match.

I've installed Visual Studio 2019 Community Edition. And I was not able to log in since then. So every time I fire up VS2019, I've been getting the nagging reminder to log in to my account and update the license.

Today I was told that in about 2 weeks, the license will expire -- and I will not be able to use the product anymore.

I've been searching the web for any working solution from the start. But I get nothing.

As I am pressed for the fix, I tried to search again. I found one article in the MSDN forums. Here are the steps proposed:

A.
1. Install IE, and make it the default browser.
2. Add the following sites as trusted sites:


Proceed with usual log in process.

B.
1. Close Visual Studio 2019.
2. Run the Visual Studio installer (download it again if needed).
3. At the top right section, there is a Provide Feedback link (person icon).
4. Click and Select either Report a problem or Provide a suggestion.
5. You will be required to sign in. Sign in.
6. Now fire up Visual Studio.
7. You should be signed in already. If not, then sign in. And you should be able to sign in.

I tried both, but A did not work. B worked, and now that I am logged in, I was able to renew my [free] license. Now I don't get the error message:

We could not refresh the credentials for the account. The browser-based authentication dialog failed to complete. Reason: The protocol is not known and no pluggable protocols have been entered that match.

Yahoo!

Till then!

22-Nov-2019, 11:12 pm GMT/UTC+8

25 April, 2018

Forcing A Windows Application To Quit On Exit

English: Graphic which hints to Microsoft Windows
English: Graphic which hints to Microsoft Windows (Photo credit: Wikipedia)
25-April-2018

Forcing A Windows Application To Quit On Exit. That was my recent problem with a Windows Forms Application I was finalizing for deployment. It is not a big program. And it is not even one that is complicated. Straightforward and simple. That's what it is. But somehow, it carried a bug.

The .exe isn't terminated by Windows. It remains in the system. I can see it using Task Manager. And how did I find out about it? I am not able to execute a Ctrl-F5 properly. I always get an error.

That is when I started checking here and there, and I found out, the program's .exe remained in the system even after I close the program. Why is that? Beats me!

I opened one of my Windows Forms program, compared the code side-by-side, and no, there is nothing different. It is the same lines of code for the 2 programs, but the former closes and system disposes of everything. The latter, no. the Form closes, but the .exe remains in the system. So I can't start a new program since to the system, it is 'still running'!

Why it behaves that way, I do not know.

Now, I said this is a piece of cake. It is easy. I know how to terminate a program so that it is removed from the Taskbar. I was thinking that the same trick should work on this new program. I mean, why shouldn't it?

But I was wrong. It did not work! How can Visual Studio codes be so quirky?

Anyway, I did some direct codes, testing a few lines a couple of times. And guess what? Here's what worked:

Application.DoEvents();
if (Application.MessageLoop) {
    // WinForms app
    Application.DoEvents();
    Application.Exit();
}
else {
    // Console app
    Environment.Exit(0);
}

That 'if' section, it is meant to be for Windows Forms applications, and the 'else' clause, that is meant to be for non-Windows forms programs, like a Console application. That's the 'normal' way of things. Supposedly the 'right' logic.

But wait.

After trying it the normal way, it didn't work. So I tried it the extra-normal way: use Environment.Exit(0) in my Windows Forms application. And you'll guess it already. It worked!

I guess that is an experienced programmer's edge over the newbie. Not all the time, things work normally. And when it happens, the veteran knows how it is done rightfully, or maverick.

So I hope that you have learned a new thing today: Forcing A Windows Application To Quit On Exit.

Till then!


[Drafted on 26-March-2018]


14 July, 2014

Code 13EC - error installing VS2010 SP1 Update

Visual Studio
Visual Studio (Photo credit: Jonathan Caves)
14-July-2014


For a time and a season, I struggled with this error code, Code 13EC, which is related to the installation of Visual Studio 2010 SP1 Update.

Not that it happens to all computers that carries Visual Studio 2010, but to one, or two.

So it beats me to some confusion, what's wrong?

Try as I will, whenever I have time, the result is the same: Code 13EC, error installing Visual Studio 2010 SP1 Update.

The Best System Optimize Software

If I am not mistaken, whenever there is some update for Windows, this KB is included, and every time, it would fail. What's wrong?

I searched, and found some articles, but none helped. It helped others, but not me.

Then while doing some other updates, which was not coursed through Windows Update, I just thought of 'hitching' this particular update to the batch, which is using MS Web Platform Installer. My guess and trial was backed by my finding the same update when I searched for updates using that particular application.

And... voila!

It worked!

And did I try it on the other computers? You betcha! And it worked also!

So if you are getting Code 13EC, error installing Visual Studio 2010 SP1 Update, try MS Web Platform Installer. It just might be the answer to your problem.

Who knows?

Till then!

20 March, 2014

My bet on Java IDE

intellij-shop
intellij-shop (Photo credit: dibau_naum_h)
20-Mar-2014

I have been spending some time on learning Java (7), and I was fortunate enough to grab a copy of Jay Bryant's book, Java 7 for Absolute Beginners. There's a bit of contradiction here... I surely am a beginner in Java, but I have known C# for a decade now, and the pleasant surprise I got when I started reading the book!

The 2 programming softwares were very identical, I could say 99%, in form and substance. And of course, going through the history of how they came about, why woulnd't they be? It is just that they originated from two rival camps, but the structure and capabilities given to them, I believe were at par.

The curiosity came about while job hunting: there were many job ads that indicated the need for a Java developer, but in parenthesis, C#.NET are welcome to apply. Took me a few job ads to realize the obvious, but then again, not immediately.

You see, I shun away from Java years ago, even though I was using native C in my school days. That was due to my poor experience with UNIX, but then again, it was not a mandated skill, and when I was starting to learn UNIX, I just didn't have a nice encounter with the OS, being already exposed to DOS, which is more verbose when it comes to its commands. Then I came across BASIC, then QBASIC. This really put a wedge between me and UNIX, the power and capability of which I will never know. I simply can't 'grep' the commands, and with nobody around to guide me, it became 'awk'-ward. I mean, I can read and learn by doing when I can, but I simply didn't get that chance - which I got with DOS and BASIC.

So I was quite surprised when I finally got to learn Java; I was at home, very much at home. Even so, the abstract-ness of the two software became more familiar to me. That was good, I never skipped a page, and the things that I would have forgotten in C#, the terms, the methodologies, they were refreshed in my memory, and what's more, I am learning Java!

Now, being so at ease with Visual Studio IDE made me a bit frustrated with the IDEs that were available for Java development. I have been trying to put my hand in on Android programming, and I started with Eclipse IDE, which is too much for beginners. Just look at the list in their website, and it would be too much, so overwhelming, really. As for Android, I have also tried Android Studio, by Jet Brains.

There is also NetBeans. The feature that I was looking for in Eclipse and NetBeans is the feature that I become accustomed with in Visual Studio, two actually, namely: intellisense and auto-completion. Now, I am not saying that Eclipse and NetBeans don't have these features, but the behaviour isn't what I wanted. Eclipse would automatically add ".*;" after pressing enter. That isn't the case for NetBeans.

Oracle offers JDeveloper IDE, but sadly, you have to be really a geek to make it run: I can't even install it! I've been doing softwares since 1996, but I have chosen a motto that if anything should work, it should be easily usable, even by the dumbest person.

There are many other Java IDEs available, but one IDE I have tried and I will keep: Jet Brains' IntelliJ. Fortunately, they have the Community Edition, which is free, and while being a smaller version of the Ultimate edition, the feature is not. Of course, the intellisense and auto-completion features are very close to what you get in Visual Studio.

So now at least I have two options for Java IDE: NetBeans and IntelliJ. Both free, both having the intellisense and auto-completion features, less the irksome behaviour.

Till then!

Enhanced by Zemanta

12 December, 2013

Removing iTunes and other software components

Image representing Apple as depicted in CrunchBase
Image via CrunchBase
10-Dec-13

After installing Visual Studio 2013, I thought I wouldn’t need to install Visual Studio 2012 anymore. Hey, I have the higher version already, and in all aspects, that should be a ‘better’ software package. Unfortunately, when working on CSS styles, there is some mouse right-click context menu that isn’t there. I thought it really wasn’t there, but it is very clear in the eBook I am going through, Beginning ASP.NET 4.5 in C# and VB, at the point of doing styling and executing right-click and something-something should show, and it didn’t, I was wondering. You see, the eBook is designed for VS2012, but having VS2013, I used that instead.

Some of my PCs I still have VS2012, so I tried that right-click trick, and voila! There it is.

Build Style. Within the curly braces of a rule. Have in VS2012. Don’t have in VS2013.

When I searched the web on this issue, there it was, as clear as crystal, it is a bug in VS2013, and while it was already reported, and probably some fixes were done and released, probably… the bug remains.

So I had to install VS2012. And this is when my HDD space would be consumed. I run out of space.

And hunting for some software pieces that I think I can let go, I saw the Apple suite. Nothing against Apple products, but I don’t use them in this particular laptop, so I decided they will go, and of course, with many others.

As before, it is almost always a wild good chase, this removal or uninstallation of Apple products from PC. There are about 6 products to be removed, and searching for one does not turn up the others. I would remember seeing one article before that shows how to uninstall all 6, in sequence, and that I can’t find easily nowadays.

Also, some would talk about just uninstalling everything without any particular order, and say that a lot of things will still be left behind after the uninstallation is completed, and to say that to really clean-up any leftovers, use Revo Uninstaller. I have tried Revo Uninstaller before, and I would still use it given the chance, and finding the need for it. But I think that to do just the Apple suite of products, that is too much. Revo Uninstaller is one heavyweight software, and if you go beyond what you know, things will simply get screwed up.

What’s the option?

I would suggest to simply use CCleaner after doing standard (or normal) removal/uninstallation.

Anyway, here is the list, in order, of uninstalling Apple software products, from you PC.

After removal, restart, then run CCleaner. But do make sure you review the checkboxes first and uncheck anything that you don’t want cleaned up, as CCleaner sweeps and cleans, and deletes permanently.

1.    iTunes
2.    Apple Software Update
3.    Apple Mobile Device Support
4.    Bonjour
5.    Apple Application Support (iTunes 9 or later)

Reference:
Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8

Till then!
Enhanced by Zemanta

19 November, 2013

My mistake: VS2010 to VS2013 is OKAY

Screeshot of FarPoint Spread for Windows Forms...
Screeshot of FarPoint Spread for Windows Forms version 5 in Visual Studio 2010. (Photo credit: Wikipedia)
19-Nov-13

So I was wrong. I thought that the errors I got from installing Visual Studio 2013 was due to the absence of Visual Studio 2012. I was wrong.

In one of the PCs I tried to install Visual Studio 2013 without Visual Studio 2012. That means I only have Visual Studio 2010. And boy, having these old desktops can cause a lot of confusion sometimes. It did, and I thought that the errors coming up one after another, they were all due to the “jump” from VS2010 to VS2013.

I was wrong.

While installing Visual Studio 2013, some errors came, mostly about SQL-related, and I just either retried the installation (modify or repair), until a restart was mandated. The installation continued after the reboot, until it was fully completed.

I called up VS2013, and when it opened nicely without any hesitation or problem, I was satisfied. When I was able to install updates, it was when I was completely assured that the installation was okay, or that I am able to “jump” from VS2010 to VS2013. I was wrong; dead wrong.

And only after my insatiable curiosity got the better of me did I find out about it, that I was wrong, and now, I am righting that mistake.
Jump from VS2010 to VS2013 is okay; it is possible.

Till then!
Enhanced by Zemanta