Cannot build proper Android-x86 image

732 views
Skip to first unread message

D.D.

unread,
Mar 16, 2017, 11:58:41 AM3/16/17
to Android-x86
My problem is that I cannot build a fully functional android from the sources. I tried several iso's and they all seem to offer a very basic functionality. My last image was built as nougat-x86 target on x86_64 arch with userdebug variant. I'm totally following this manual: Get Source - Android-x86 - Porting Android to x86. But when I launch this android I see that:
- I'm not a root on the device, even when the Settings app states that both apps and ADB have root access;
- The OS has no Google Apps, no regular browser etc. - many standard apps are missing there;
- Some things in the OS are unstable, e.g. I can't switch USB mode from "Charging" to any other setting, say, MTP - the Settings app is crashing when I do that.
Here are the screenshots:


So, always when I'm building I receive this limited variant. Although official docs state:


Buildtype - Use
user - limited access; suited for production
userdebug - like "user" but with root access and debuggability; preferred for debugging
eng - development configuration with additional debugging tools

Besides of that I have one more question  - how can I build CyanogenMod from the sources? I don't see it in the list of available targets. And when calling lunch I still can't see it. According to this thread I tried this server:

repo init -u git://git.osdn.jp/gitroot/android-x86/manifest -b nougat-x86 -m cm.xml

Also tried official server with -m cm.xml switch. On syncing new files arrive but there are some errors when building the project. Don't know how to escape from those errors...

Somehow I want to build any variant of stable fully functional android-x86.

Henri Koivuneva

unread,
Mar 17, 2017, 4:49:10 AM3/17/17
to Android-x86
Google apps aren't included by default. You have to add them to your manifest via opengapps: https://github.com/opengapps/aosp_build/

CyanogenMod/LineageOS and downloading sources, try (.NET not .JP):
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b nougat-x86 -m cm.xml
. build/envsetup.sh
lunch cm_android_x86_64 // OR cm_android_x86 for 32bit
mka iso_img

You might have had a wrong lunch command, what errors did you get?

Try building Bliss-x86, I'm now using that and it's GREAT: https://github.com/BlissRoms-x86/manifest

Their default branch has kernel 4.4 and the n7.11-x86-unstable branch has kernel 4.10. It already has the gapps building stuff too so you don't have to manually add those things.

Good luck!

Henri Koivuneva

unread,
Mar 17, 2017, 4:51:48 AM3/17/17
to Android-x86
ah sorry, I forgot to add... The CM/LineageOS lunch command. It needs the variant added to the end, so for example:
lunch cm_android_x86_64-userdebug
lunch cm_android_x86_64-user
lunch cm_android_x86_64-eng

Henri Koivuneva

unread,
Mar 17, 2017, 5:01:11 AM3/17/17
to Android-x86
Aaaand of course use the same command to sync sources before building:
repo sync --no-tags --no-clone-bundle --force-sync

Force sync forces it to overwrite files, for example when they differ and you haven't made any changes to them. If the output says "discarded 231 commits" or something like that, check the folder next to that, like external/mesa. Then delete that folder from your Android-x86 folder (for example now the path Android-x86/external/mesa) and then do a new force sync with the above command. It shouldn't say anything about discarding commits anymore on that folder. This way you'll be sure you have the latest code!

When building, if you want to start it over from scratch, it's easiest to do:
rm -rf out
This deletes the build output folder so that no traces of previous builds are left. Then do the 3 build commands again and you'll have a completely clean new build. It will take as long as the first build does, for example on my PC a clean build takes about 40 minutes, and an incremental build that just adds latest changes it can be anything from under a minute to 5 minutes to longer.

D.D.

unread,
Mar 17, 2017, 5:38:44 AM3/17/17
to Android-x86
Henri Koivuneva

Thanks for these hints, they're very useful for me. I didn't know that GApps are not included into the build. And Bliss-x86 is something new to me. Tonight I'm going to do some takes on building again and see how it goes. One more thing - what is better - eng or userdebug? I need to be rooted "out of the box". Which versions provide that?

Henri Koivuneva

unread,
Mar 17, 2017, 6:02:52 AM3/17/17
to andro...@googlegroups.com
You're welcome!

Userdebug is rooted and gives more debug options than a regular user build, for example more in-depth logs. It's the best option if you want root. It can be enabled from the developer options like on an Android phone.

Eng build is an engineering build: it has all the bells and whistles required to see the most logs about errors and warnings and has even more debugging tools available. Root too of course. Also, because of it's engineering nature, some apps and games block themselves from running on it.

If you don't want root, you can make a user build. For me that hasn't booted for some reason the past few times I tried it last year, so I stayed with userdebug.

It'd be fun to make an AOSP Android-x86 build with Magisk and it's systemless root and rootless substratum, but I haven't had time to do it yet... Bliss-x86 has substratum (theming possible), root with SuperSU, various tweaks (like centered statusbar clock and date in statusbar, network upload and download, etc), Google apps built in and play store, taskbar and multi-window mode through the taskbar app, and more.

This app works well for rotation control from a persistent notification: https://play.google.com/store/apps/details?id=org.crape.rotationcontrol

D.D.

unread,
Mar 18, 2017, 6:04:32 AM3/18/17
to Android-x86
As I intended I tried building CM last night. It was absolutely clean build with no modifications. My settings were

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
LINEAGE_VERSION=14.1-20170318-UNOFFICIAL-android_x86_64
TARGET_PRODUCT=cm_android_x86_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_CPU_VARIANT=
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-22-generic-x86_64-with-Ubuntu-15.04-vivid
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NOF26W
OUT_DIR=/home/android/android_nfc/out
============================================

But I have not succeeded with this because of various errors during the build process. At first time it showed me the following:

ninja: error: dependency cycle: /home/android/android_nfc/out/target/product/android_x86_64/kernel -> /home/android/android_nfc/out/target/product/android_x86_64/kernel
build
/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make
: *** [ninja_wrapper] Error 1
make
: Leaving directory '/home/android/android_nfc'

#### make failed to build some targets (07:29 (mm:ss)) ####

After disabling ninja I received this message:

  symbol:   class PreferenceViewHolder
  location
: class SelfRemovingPreference
javadoc
: error - In doclet class com.google.doclava.Doclava,  method start has thrown an exception java.lang.reflect.InvocationTargetException
com
.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.android.okhttp.ConnectionPool not found
1 error
39 warnings
build
/core/droiddoc.mk:170: recipe for target '/home/android/android_nfc/out/target/common/docs/cm-api-stubs-timestamp' failed
make
: *** [/home/android/android_nfc/out/target/common/docs/cm-api-stubs-timestamp] Error 45
make
: *** Waiting for unfinished jobs....
make
: Leaving directory '/home/android/android_nfc'

#### make failed to build some targets (12:36 (mm:ss)) ####

So currently I stopped at this point. Maybe I would have better luck with Bliss-x86, I don't know. The whole process is very slow because I'm running Ubuntu on VirtualBox (the compilation takes many hours!). I know I should find a way to run Linux on dedicated machine.

Henri Koivuneva

unread,
Mar 18, 2017, 7:07:07 AM3/18/17
to andro...@googlegroups.com
Ahhh hey did you follow the Google Android build instructions? You need openjdk8 for this, not Sun Java. I think that's behind the errors. Would you like to try with that instead? Make sure to completely uninstall Sun/Oracle Java first. Also check the Bliss GitHub page and make sure you have installed the dependencies listed there :)

--
You received this message because you are subscribed to a topic in the Google Groups "Android-x86" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-x86/lPuQePQmacI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-x86+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-x86.
For more options, visit https://groups.google.com/d/optout.

Henri Koivuneva

unread,
Mar 18, 2017, 7:07:47 AM3/18/17
to andro...@googlegroups.com
Also, if it still gives errors, try Ubuntu 16.04.

D.D.

unread,
Mar 18, 2017, 11:45:35 AM3/18/17
to Android-x86
Henri Koivuneva

I was using OpenJDK from the very start. I tried to completely uninstall and reinstall it but the errors are still there. Now it looks like this:

javadoc: error - In doclet class com.google.doclava.Doclava,  method start has thrown an exception java.lang.reflect.InvocationTargetException
com
.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.android.okhttp.ConnectionPool not found
1 error
39 warnings
build
/core/droiddoc.mk:170: recipe for target '/home/android/android_nfc/out/target/common/docs/cm-api-stubs-timestamp' failed
make
: *** [/home/android/android_nfc/out/target/common/docs/cm-api-stubs-timestamp] Error 45
make
: *** Waiting for unfinished jobs....

warning
: ignoring flag -c mdpi-v4. Use --preferred-density instead.
warning
: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning
: ignoring flag -c mdpi-v4. Use --preferred-density instead.
warning
: ignoring flag -c hdpi-v4. Use --preferred-density instead.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
make
: Leaving directory '/home/android/android_nfc'

#### make failed to build some targets (17:53 (mm:ss)) ####

And many other errors before like this one:

  symbol: class Preference
vendor
/cmsdk/sdk/src/java/cyanogenmod/preference/SelfRemovingPreference.java:52: error: cannot find symbol
   
public void onBindViewHolder(PreferenceViewHolder holder) {

My Ubuntu is 15.04. Maybe it's really good decision to check it on the fresh distro. So I'm going to fire up recent Ubuntu on my second computer and build again as working in VM turns to real nigmare to me.

D.D.

unread,
Apr 2, 2017, 6:43:02 AM4/2/17
to Android-x86
Henri Koivuneva

Sorry for that private reply.

Finally I had success with the build I wanted. I have installed the recent Ubuntu 17.04 on my notebook and tried again, but had no luck with CM due to some new errors (similar to these ones). So I switched to Bliss-x86 and it worked as a charm! The eng build is very cool and has all the tools for advanced users including GApps and root. I think, my issue is resolved. There's a little wonder of why CM build is unsuccessful but I'm not going to figure it out now.

Henri Koivuneva

unread,
Apr 2, 2017, 7:48:01 AM4/2/17
to andro...@googlegroups.com
Great news! It could be that something somewhere broke CM. Congrats!

--
Reply all
Reply to author
Forward
0 new messages