Android Building From Source error: could not load boot.img - android

I have followed the instuctions as posted on http://source.android.com/source/index.html to build an Android Source Environment. I am using Ubuntu 10.04. The process went without problems. After hours of downloading the Source Tree (I Have tried several including 2.1 and 4.0.1) and execution of the make command all image files were created in the directory '/WORKING_DIRECTORY/out/target/product/generic' except the boot.img file. I read across the internet that it is possible to create an own boot.img file using 'mkbootimg'. However I would like to avoid this in first place and use this option only as a last resort, because I am not familiar with the process as it requires some header files I am not certain of where to find them. I am curios why the boot.img file was not created.
Is somebody facing the same issue or maybe has solved the issue?
Best Regards

You've built your image for an emulator. Thus, you not need an boot.img to run an emulator and that's why it is not in your directory. You should make build for a particular device. If this device is Google device you'll have no problems - just follow the instructions on the webpage: http://source.android.com/source/building-devices.html

Related

Building android source and flashing it in emulator

I'm trying to build Android Nougat source following the instructions provided here. For the source code and tags I'm not sure what to opt for so I opted for,
N2G48H android-7.1.2_r36 Nougat 2017-10-05
make is successful it created image files within out/target directory. When I tried to flash it on emulator by simply typing emulator I'm seeing some weird device like this.
Got doubted on my target device type so tried following the instructions provided in this answer but still I'm seeing the same weird screen. Any help on this would be much appreciated.

Why adb sync leads to boot failure while make snod works fine?

I am trying to build a custom rom in AOSP angler-debug (Nexus6p, 8.0).
Full build works fine.Then I change some code in
framework/base/core/java/..
and run
mmma framework/base
to rebuild the framework.
Here is the problem :
When I use adb sync to update framework, it leads to boot failure:
"didn't find class "com.android.providers.settings.SettingsProvider on path: ...."
"No original dex files found for dex location /system/priv-app/SettingsProvider/SettingsProvider.apk"
When I use make snod and fastboot flashall to flash system image, the device can boot correctly and the modified code effects.
Question :
Is there something different between these two commands?
There are some mechanisms in framework to make sure the framework.jar is the original one when device is flashed. It seems that other parts of framework does not have this limitation.
In my experience, if your change codes other than framework/base, adb sync is fine, otherwise flash system image to avoid weird things.
You should feel lucky that building speed is way faster in AOSP 8, when I worked with AOSP 5, build the framework/base is a disaster.

Building WebView From Chromium for Android

I am trying to follow the instructions to build the webview apk from chromium base. I am running a Android-7.0 build. I finished the compilation process for chromium and generated the APK. I have two questions related to steps after APK generation.
Firstly the library name is different from what I expected. The default webview.apk has a library name libwebviewchromium.so, but the APK I built from chromium (SystemWebView.apk) contains the lib libwebviewchromium.cr.so. I wanted to ask whether that can cause problems and if others also saw this.
Secondly, I am unable to uninstall the com.android.webview app from the device. The instructions require uninstallation of this app and deleting its folder before the new APK can be installed. I get the error:
$ adb uninstall com.android.webview
[DELETE_FAILED_INTERNAL_ERROR]
I wanted to ask if anyone knows how to resolve this. I saw a related question and want to ask if there is any other approach that doing what this answer suggests.
The following answer is related to the second part of my question.
I did the following steps to make the SystemWebView.apk work (note: the webview.apk was a system app in my build under /system/app; the steps below were used to install & test SystemWebView.apk as a third party app)
(Take a look at step 6 first for taking back up of 2 files)
Firstly I followed the linked answer to adb pull & edit the packages.xml and packages.list files (I haven't pushed them yet)
adb shell stop
I push the two files
I then deleted the following folders (basically any trace of com.android.webview):
/system/app/webview
/data/data/com.android.webview
/data/user/0/com.android.webview
/data/misc/profiles/cur/0/com.android.webview
/data/misc/profiles/ref/com.android.webview
/data/user_de/0/com.android.webview
adb install SystemWebView.apk
I also had kept a back up of libwebviewchromium64.relro and libwebviewchromium32.relro files from /data/misc/shared_relro/. After the install, I noticed that these files get erased for some reason, so I copied them in again (first copying into sdcard and then moving into shared_relro folder).
adb shell start
After that I tested a simple app containing a WebView, and could see web pages loaded.
You have to build SystemWebView.apk with
ninja -C out/Release system_webview_apk
For more details check this page.
https://chromium.googlesource.com/chromium/src/+/master/docs/android_build_instructions.md
and
https://www.chromium.org/developers/how-tos/build-instructions-android-webview
adb uninstall com.android.webview
fails because this is a system app, you can directly replace the webview.apk in
/system/app/webview/ dir, after this do stop && start
for this you need root permission.
Native web view has many limitations in performance and caching.
I would rather suggest you to CustomTabsClient, a web view supported by Chrome Browser. you could get it by adding following dependencies to your project.
dependencies {
...
compile 'com.android.support:customtabs:23.3.0'
}
For more detail visit.
https://developer.chrome.com/multidevice/android/customtabs

How to install SL4A on emulated android phone

i'm currently reading through head first python and upon reaching chapter 8 I got stuck. The book wants me to download SL4A from the link http://code.google.com/p.android-scripting however that link no longer works. So I did some searching and found the file on github. My real problem is when I try to download it on the emulated device it just says waiting for data connection and it never downloads. I am wondering if there is a way to fix this. Any help is appreciated thanks!
EDIT: to get it to work I downloaded both files from here https://github.com/kuri65536/python-for-android/blob/master/README.md
then I copied the files to the folder
C:\Users\lucas\android-sdks\platform-tools
then I opened CMD and cd to the path above.
then use the command:
adb install (filepath)
for both files and they appeared on the emulated device.
Download to your pc and push through ADB.
Download files and adb install worked for me in my installation (Windows 10, android studio 2.1.1) with minor differences:
1) adb command is located in:
C:\Users\MyUser\AppData\Local\Android\Mysdk\platform-tools
Need to add to path
2) Needed release sl4a-r6.1.1-x86-debug.apk. Downloaded it from release pages
I'm also reading through HeadFirstPython and got stuck at this stage (with the error: app not installed). I tried the abs method above and ended up with yet another problem: install_failed_no_matching_abis. After a lot of research, I got to understand that the "native libraries" of the sl4a.apk were not matching the system architecture of my emulated android. In other words, if one wants a faster emulator in android studio, he ought to use an x86 architecture android; but the problem with that is scripting layer for android is programmed to work on ARM architectures hence the 'install_failed_no_matching_abis' error.
The solution that worked for me was to go back to AVD in Android Studio, delete the downloaded emulator (which was of x80 cpu/abi) and download one with armeabiv7 cpu, recommended level=24. It took a lot of trial and error to get to this choice as other android cpu/abi were either too slow or just wouldn't allow me to install the required apps.
Edited: In the end, I was directed to use GenyMotion as that performed better in terms of speed. I was reluctant at first but, to my surprise that really is the case (It is super faster than ARM android studio alternative). Not only is it a great emulator, it also has this ARM translation tools that allows one to easily install ARM sl4a.apk on the x86 devices.

Error while installing application (INSTALL_FAILED_DEXOPT)

I am working with ccr4j API in Android so when I run my project its thrown an error like:
Error while installing application (INSTALL_FAILED_DEXOPT)
I find from net and same site also, did all trying like,
1. Uninstalled same application from device.
2. Run Emulator with Wipe User Data.
But still same error comes.
So anyone know why its thrown this kind of error?
This most likely has to do with the size of classes.dex. On anything pre-ICS dexopt will fail on anything over 5mb. Check the size of classes.dex in your apk. It would also be good to see what your method count is as dex has a 65536 method/field limit.
I have same problem. Checked classes.dex file and it is about 7mb's. I'll try to find a solution. I hope Facebook's solution solves mine too.
By the way thanks for information #Jared.
https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920
Edit 1: I've solved this problem by using proguard optimization. My previous classes.dex file was about 7mb, and after proguard optimization it became 4mb. And now I can run this obfuscated and optimized apk on 2.2 and 2.3 devices.
Edit 2: Official Google Multi Dex support is the best solution for this issue. https://developer.android.com/tools/building/multidex.html
Find Android SDK folder. (Usually C:\User\AppData\Local\Android\sdk) Delete folders which starts with dot(.), they are temporary downloads files. Then delete Android Emulator from SDK Manager. Then run Android Studio as administrator and then download and install Android Emulator again. And make sure you have installed Intel H.A.X.M.. Now you can create emulator and use it without errors.

Categories

Resources