Building Android (Resurrection Remix) Nougat From Source For Sony Xperia Z3

· 3 min read
Building Android (Resurrection Remix) Nougat From Source For Sony Xperia Z3

Resurrection Remix is always one of my favorite Android variants. It did have official builds for Xperia Z3 (D6603/D6653) but not availabe any more. Since its device are free to access on the web, I decided to build one for my Xperia Z3.

Source Code, Environment and Other Preperations

  1. Install Dependencies. On Ubuntu 17.04, use
sudo apt install bc bison build-essential curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
  1. Download the source code following RemixResurrection's guide.
  2. Use local_manifests.xml to download additional device and blobs.
  3. Use in device/sony/z3/ to extract properties. This script can either extract them from a up and running Xperia Z3 using adb pull, or extract from a expended ROM.
  4. vendor/sony/msm8974-common/proprietary/vendor/lib/ and vendor/sony/msm8974-common/proprietary/vendor/lib/ is still missing. Use the blobs from other Snapdragon 801 target to build. Here I'm using vendors from OnePlus.
  5. When device and blobs are ready, run source build/ then breakfast z3. Note that build/ may not work properly with shells other than bash.
  6. Setup CCACHE using
echo "export USE_CCACHE=1" >> ~/.bashrc
prebuilts/misc/linux-x86/ccache/ccache -M 50G
  1. brunch z3.

Once the compile is completed, you can find the package in out/product/sony/z3 or $OUT.

Solving Errors

  • ERROR android_frameworks_base/libs/hwui/tests/microbench/FrameBuilderBench.cpp: No member named 'range' in 'benchmark::State'
    The error is introduced by this commit. It's originally a fix to deprecated state.range_x() calls, but this function is still provided as a standard API and being widely used (even in official demos) in Nougat MR2.3 release. FrameBuilderBench.cpp in AOSP Nougat MR2.3 release still use range_x() but not range(0). The newer version of google/benchmark library also utilize a new building system by providing a Android.bp file instead of file as a make script. It would be a problem of messing up different versions of repos when RemixResurrection team merge to Android Oreo.
    Simply replace all the state.range(0) with state.range_x() solves the problem.

  • ERROR /frameworks/base/media/tests/CameraBrowser/src/com/android/camerabrowser/ Locale cannot be resolved
    Seems to be a problem of calling Resources.getSystem() without importing android.res.content.Resources package, as well as calling Locale.CHINESE without importing java.util.Locale. Adding the import sentences will get rid of it.

  • frameworks/base/packages/SystemUI/res/layout/battery_bar_rot0.xml:28: error: No resource identifier found for attribute 'viewLocation' in package '' and frameworks/base/packages/SystemUI/res/layout/battery_bar_rot0.xml:35: error: No resource identifier found for attribute 'viewLocation' in package ''. It may related to a bug in Android with custom widget namespace detection (?). In layout files, change the namespace declaration xmlns:systemui="" to xmlns:systemui="" seems to work. There're some more files have the same problem and can be similarily modified to get them fixed and built.
    See also this commit in AOSP source.
    Note: This error is gone while compiling using brunch z3 instead of make

  • frameworks/base/packages/SystemUI/res/layout/card.xml:22: No resource identifier found for attribute 'cardBackgroundColor' in package ''
    The codes seem to be alright. No idea about it till now. Deleting it solves the problem.
    The above two bugs happened with records here.
    Note: This error is gone while compiling using brunch z3 instead of make