How to create a working AVD for Jellybean (API 17)? - android

I attempted to create an AVD for Jellybean (API 17) in Kubuntu 17.04 using the following procedure:
Launch the AVD Manager from Android Studio
Click the "Create Virtual Device" button:
Select the Nexus 4 hardware profile:
Click "Next"
Click the "x86 Images" tab and select "Jelly Bean / 17 / x86 / Android 4.2 (with Google APIs)" image:
Click "Next"
Leave the settings at their defaults:
Click "Finish"
Now, due to an unfortunate issue with Ubuntu 17.04 (and its derivatives), it is not possible to launch the emulator directly by clicking the play button next to its entry. (Clicking it does nothing.) Instead, I must launch the emulator from the terminal with:
$ cd ~/Android/Sdk/tools
$ LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ./emulator -avd Nexus_4_API_17
The emulator starts and the home screen appears:
However, interacting with it immediately reveals that there is a problem. The camera displays an error:
Clicking on "Storage" in the Settings app causes the Settings app to crash.
What did I do wrong and how can I fix this?
Edit: I clicked "Show Advanced Settings" and confirmed that an SD card was indeed to be created:
I also confirmed that the file ~/.android/avd/Nexus_4_API_17.avd/sdcard.img.qcow2 exists.
Edit: I followed the same procedure to create a Kit Kat AVD (using the Nexus 5 hardware profile) and the issue is not present there. The SD card works as expected.
Edit: I tried using mksdcard to manually create an SD card image:
mksdcard -l TEST 100M sdcard.img
...and then passing it directly to the emulator:
emulator -sdcard sdcard.img -avd [...]
...but this made no difference.
However, I discovered something interesting after opening a root terminal on the device (using adb shell) and running the mount and df commands:
# mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
/dev/block/vda /system ext4 ro,relatime,data=ordered 0 0
/dev/block/vdb /cache ext4 rw,nosuid,nodev,noatime,errors=panic,data=ordered 0 0
/dev/block/vdc /data ext4 rw,nosuid,nodev,noatime,errors=panic,data=ordered 0 0
# df
Filesystem Size Used Free Blksize
/dev 757M 68K 757M 4096
/mnt/secure 757M 0K 757M 4096
/mnt/asec 757M 0K 757M 4096
/mnt/obb 757M 0K 757M 4096
/system 532M 349M 183M 4096
/cache 60M 40K 60M 4096
/data 1G 75M 1G 4096
It appears as if the SD card isn't being mounted, since /dev/block/vdd is missing in the output above and none of the partitions have a capacity of 100M.

After some research I'm ended up to an answer: JellyBean is too old to be used on recent emulator.
If you want to continue to use this system and wanto to use also the sd card, this can be a nice workaound for you.
Launch manually the emulator as:
cd ~/Android/Sdk/emulator
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ./emulator #Nexus_4_API_17 -verbose -engine classic
Note the -engine classic that will load the old/classic qemu with kernel kerne-qemu instead of new qemu2 with kernel kernel-ranchu (available options are: auto, classic, qemu2)

try using Genymotion. it much faster.
Genymotion operation relies on the use of Oracle VM VirtualBox in the background. This enables virtualizing Android operating systems. If you do not already have Oracle VM VirtualBox installed, you will be asked to do so prior to installing Genymotion.

When you create an AVD it's possible to say whether to emulate SDCard or not (and of what size). Looks like you simply did not specify the SDCard presence. Edit your AVD settings and make sure you have explicitly requested for SDCard support. I think this options in Advanced settings in your step 7.

For settings issue
Edit the hardware profile and change the dimensions to 4.2 inches(Not sure Why? But i think upto 17 max resolution available was 4.2 inches).
Reboot the device
Your settings will start working.
For camera
The issue is the file system which is in read only mode. You need to change the file system. Check this link.
After changing the file system push few images and restart.
Another issue i found that there is no DCIM folder present.
Try creating the /mnt/sdcard/DCIM and add few images too.
Reboot again. Everything will start working.

You can use genymotion:
https://www.genymotion.com/
Genymotion is an emulator using x86 architecture virtualization,
making it much more efficient!
Taking advantage of OpenGL hardware acceleration, it allows you to
test your applications with amazing 3D performance
http://hackpundit.com/android-emulator-genymotion-installation/

Related

Does ext4 filesystem in read-only mode has better performance for mobile devices then ext2?

Android uses ext4 file system for read-only partitions, but in my opinion for flash read-only drives ext2 is more appropriate, because it does not have performance overhead and safe for using without write operation.
Am I right?
I don't have the true answer, but here are some possibilities.
ext4 has improvements over ext2 even in read-only mode, such as using extents rather than block maps. This saves on metadata overhead.
The system partition can be remounted read-write on rooted devices, and during system updates (except on Nougat+ devices using two system partitions for seamless updates). ext4 generally has better allocation behavior than ext2.
The filesystems may be created with -O ^has_journal, which removes the overhead of journaling from ext4. (See the -j option to mkuserimg_mke2fs.sh.)
Also, given that ext4 is already in use for the read-write user partition, I suspect there would be a tendency to avoid ext2 just to reduce the total amount of different code that is being run (and needs to be tested). Some ports unset CONFIG_EXT2_FS to shrink the kernel. (ext2 filesystems can still be mounted using the ext4 driver, although I don't expect this to be done.)
Why does Android use ext4 file system for read-only partitions?
Not really an expert here and probably won't give a specific answer but, as you surely know, Android heavily leans on Linux and the choice might have been Linux-dictated.
The great work by Jonathan Levin which has lately become free and which I strongly recommend you to get familiar with states the following*:
"Android enforces no constraints as to the filesystem types, but eMMC and MMC devices presently use the Linux Ext4 filesystem (as of Gingerbread, in place of the older YAFFS system), since the storage layer exports a block device. Ext4 has become the default filesystem in Linux as of 2.6.27, and is a well tested filesystem, albeit not a necessarily flash-optimized one."
* Chapter II -> Partitioning Scheme -> File Systems
Also ext4 without using journal has better performance then ext2:
ext2 ext4, default ext4, no journal
initial writes 13.0 MB/s 15.4 MB/s 15.7 MB/s
rewrites 13.1 MB/s 15.6 MB/s 15.9 MB/s
reads 15.2 MB/s 16.9 MB/s 17.2 MB/s
re-reads 15.3 MB/s 16.9 MB/s 17.2 MB/s
re-reads 15.3 MB/s 16.9 MB/s 17.2 MB/s

"mount: Invalid argument" on Android

I'm trying to mount an ext4 partition located on my SD card with the following:
# mount -t ext4 /dev/block/mmcblk1p2 /data/sdext2
But it always returns "Invalid argument". I've verified that ext4 is supported through /proc/filesystems.
Ideas on how to troubleshoot?
Turns out the SD card I bought from eBay was fake. It was packaged and branded as a 32gb card but the real capacity was 16gb. That's why it failed every time I tried to do 16gb FAT32 and 16gb EXT4. There wasn't any room for the second partition.
If I do 8gb each, it starts working again. Also works if I use a different card.

Google Play Store insufficient storage error

I own a rooted Samsung Galaxy Tab 2 7.0 (GT-P3110). Im using Android 4.2.2 and Cyanogenmod 10.1.3-p3110.
Since a few days my tablets play store screws up installing some apps. I get an insufficient storage error after the installprocess starts everytime (when the download has ended). This occurred with youtube but strangely enough not with some barcodescanner app. When I look at my usage of internal storage however there seems to be more than 2 gigs of free space left.
The internet is full of people getting this error. I tried many solutions, but none of them seem to work. I tried to wipe the cache and dalvik cache. Also I tried to look at the free internal storage in different ways. Nothing seems to work. However I can put apks on my tablet via usb and then install them without any problems. This isnt really practical though.
Also updates are going fine too. I dont get this error when apps update automatically.
Edit: Also tried to fix permissions in Clockwordmod Recovery, didn't help
Edit 2: A copy of df command in terminal
u0_a40#android:/ $ su
u0_a40#android:/ # df
Filesystem Size Used Free Blksize
/dev 387.4M 48K 387.3M 4096
/storage 387.4M 0K 387.4M 4096
/storage/emulated 387.4M 0K 387.4M 4096
/storage/sdcard1 23.9G 32K 23.9G 16384
/mnt/secure 387.4M 0K 387.4M 4096
/mnt/asec 387.4M 0K 387.4M 4096
/mnt/obb 387.4M 0K 387.4M 4096
/mnt/fuse 387.4M 0K 387.4M 4096
/system 1.3G 374.9M 1003.1M 4096
/efs 19.7M 4.1M 15.5M 4096
/data 4.6G 2.5G 2.1G 4096
/cache 689M 70M 619M 4096
/mnt/shell/emulated 4.6G 2.5G 2.1G 4096
/storage/emulated/0 4.6G 2.5G 2.1G 4096
/storage/emulated/0/Android/obb 4.6G 2.5G 2.1G 4096
/storage/emulated/legacy 4.6G 2.5G 2.1G 4096
/storage/emulated/legacy/Android/obb 4.6G 2.5G 2.1G 4096
u0_a40#android:/ #
Navigate to settings->Apps->Running Apps and select "Google Play Services" click on uninstall latest updates and things should work again.This is a bug from google play and it creates multiple copies of your app directory in memory.
Going to Settings > Apps > Choose Google Play Services and then Clear Cache, worked for me!
Ended up flashing a new rom. I am using Slimkat 4.4.4 now and had to flash it using the latest Philz Touch which I found right here https://goo.im/devs/philz_touch/CWM_Advanced_Edition/p3110/
The problem now seems to have been solved, although I didnt prefer this particular solution. Oh well.
As far as I know, the only known "solution" for non-rooted devices whose cache and app data have already been wiped is to apply a factory reset.
If you change your mind and decide to root your phone, I suggest you install Android SDK Tools Only on your computer, then root your phone, go to Android's Settings, then Developer Options, then activate USB Debugging. After you do this, use a USB cable to connect your Android device to the computer where you installed the SDK tools.
The SDK tools have ADB (Android debugger). Open a shell window, go to the folder where the SDK tools were installed, look for a folder named platform-tools and access it. Inside this folder there will be an executable binary file named adb (or adb.exe, if you're using Windows). Then run the following command in order to make ADB access the command prompt of your Android device:
adb shell
Now that you're in your Android device shell (commands interpreter), run this command in order to become root (also known as superuser):
su -
Afterwards, run this command to check what's your system's default APK install location:
pm get-install-location
If the command above returns 2, it means that the Android package manager (pm) is incorrectly configured to install APKs in your external storage (e.g. microSD card) instead of in your device's internal storage (which is the correct one).
In order to fix it, run this command:
pm set-install-location 1
1 means internal storage media.
Now restart your device with this command:
reboot

adb install fails with error 'INSTALL_FAILED_INSUFFICIENT_STORAGE'

I have bought my first Android mobile Sony Xperia M without being aware of the issue that we can't move apps to external sd card. Refer this link for details.
The only thing Sony advice is to root the device, partition and use third party apps to move it. They also mention that rooting may void warranty.
My Android Details of Sony Xperia M is listed below
Model number C1904
Android version 4.1.2
Build number 15.1.C.2.8
I have tried running the below commands from some forum and it is not working for me,
adb devices
adb shell pm get-install-location
adb shell pm set-install-location 2
Though the above commands doesn't prompt any error and I can get the install location as 2 (with adb shell pm get-install-location). So I believe it has set properly. But then I tried installing some apps and it is only installing in the internal memory only.
I have tried 'apps2sd' utility to move my apps and it is showing the below error,
'The device does not have a real primary external storage, or the primary external storage is emulated. Moving app to SD function cannot be supported by this device.'
Finally from another forum, I understand that we can install apk files through 'adb install' command to install directly into the sd card as below,
adb install -s C:\com.furkan0gul.mvanparking.apk
The above command fails with this error,
3531 KB/s (13523837 bytes in 3.740s)
pkg: /sdcard/tmp/com.furkan0gul.mvanparking.apk
Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
I have enough space (more than 6GB out of total 8GB memory) in my external card. You can find this using below command,
>adb shell df
Filesystem Size Used Free Blksize
/dev 402M 64K 402M 4096
/mnt/asec 402M 0K 402M 4096
/mnt/obb 402M 0K 402M 4096
/system 1183M 907M 275M 4096
/cache 246M 4M 241M 4096
/persist 3M 80K 3M 4096
/firmware 63M 43M 19M 16384
/data 2101M 1401M 700M 4096
/lta-label 15M 4M 10M 4096
/storage/sdcard0 2101M 1401M 700M 4096
/storage/sdcard1 7572M 1088M 6483M 32768
If I run the adb install command without '-s' switch, it installs fine in internal memory without any issues as below,
> adb install C:\com.furkan0gul.mvanparking.apk
2549 KB/s (13523837 bytes in 5.180s)
pkg: /data/local/tmp/com.furkan0gul.mvanparking.apk
Success
While installing to sd card, app seems to be installed in '/sdcard', but no mount of such thing there in 'df' command output. Also tried searching this 'INSTALL_FAILED_INSUFFICIENT_STORAGE' by google. Most of them asked to do some changes in emulator to get this done. I have uninstalled the app, restarted the device and tried installing again into sd card but not working ended with the same insufficient storage error.
I am not using emulator. I am just directly installing apk into my sd card. I dont want to root the device and void warranty offer.
Appreciate if some one could send your ideas on this.
There is a simple workaround.If your test device is running Android 2.2 or later then add the
android:installLocation
attribute to your application's manifest file, with the value "preferExternal". This will force the app to be installed on the device's external storage, such as a phone's SD card.
For example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dem"
android:installLocation="preferExternal">
I have a Fairphone (first edition) with applied unified storage. The INSTALL_FAILED_INSUFFICIENT_STORAGE problem should have been gone with the unified storage. Nevertheless, it showed up after a few month despite having 12gb of free disk space. For me, the following steps solved the issue
Install an ssh server on your phone
Login
su (in case you're not root)
pm set-install-location 1 (set to external memory)
Since I HAVE enough space on the internal memory, this is preferred over the external memory (which I probably don't have anymore due to the unified storage). This might be specific to the Fairphone

Unable to change permission of the sdcard(emulator),can any1 guide me how to change them?

the permission of my sdcard is Irwxrwxrwx
i am unable to push any files in it
Android Emulator sdcard push error: Read-only file system
how to change permission of DDMS / File Explorer / sdcard?
Change file permissions in DDMS (Android)
i have gone through many questions some of them have been posted above,they didn't help..
i even tried getting an image from a friend,with read/write permissions but that didn't help either.
Sometimes the problem comes for something simpler: my SD Card was FAT32 formated and this problem finished when I changed the filesystem to NTFS.
You first need to create an SD Card image. This can be done in the AVD Manager at the same time as creating the AVD image.
The SD Card image has to be mounted too (i.e. if you use an already mounted SD Card). When no card is mounted, /sdcard is treated as a folder of /system. So when you try to write to /sdcard on an AVD image without an SD Card mounted it tries to write to /system which is read-only.
Update:
Make sure your SD card is mounted correctly. Use adb shell (or adb shell emulator-5554 when your real device is also plugged in) and enter df in the shell.
The output should look like this
Filesystem Size Used Free Blksize
/dev 378M 32K 378M 4096
/mnt/asec 378M 0K 378M 4096
/mnt/obb 378M 0K 378M 4096
/system 194M 191M 2M 4096
/data 194M 8M 185M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
Make sure that this two lines are present.
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
This means, that the SD Card is mounted correctly.
That being said: DO NOT IN ANY CASES NEVER EVER USE HARDCODED /sdcard/... PATHES. Always use Envirnoment.getExternalStorageDevice() (for multi-user) or Environment.getExternalStoragePublicDirectory (String type) (for public folders accessible to all users)
For Clarification: The SD Card is mounted in a different physical path depending on manufacturer of the ROM. Back when Android first appeared, all external cards where mounted by default in /sdcard since back then all devices had small internal memory and SD-Card slots.
Newer Android Smartphones often ship without an SD Card. The newerones with 1-16 GB internal memory, like tablets, do not mount to /sdcard instead they mount by default to /mnt/sdcard. But it also depends on vendors. One vendor use one way over the other way. Tablets w/o SD Card for example use part of the internal storage to mount to the old /sdcard for compatibility reasons. Always use the API to get the path to internal storage memory!
Envirnoment | Android Developers
http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29
or
http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory%28java.lang.String%29

Categories

Resources