Add custom build to Android studio emulator

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Add custom build to Android studio emulator

Bastien Chanot
Hi everyone ! I hope you are all good =)

I am talking to you today for asking you something. I don't find any answer on internet, so maybe some of you got it !

I just built a AOSP build, successfully, and i wish to add it to my android studio emulator. (on Ubuntu !)

I tried to follow the link https://source.android.com/setup/create/avd, i followed the process correctly, added the link ( like this file:///home/bchanot/Custom/repo-sys-img.xml)
But when i am trying to create an AVD through the Android Virtual Device software, i cannot find the image i specified in link.

Can someone help me ?

Thanks for all and sorry if i am not clear enough, ask me some questions !

Best regards,
Bastien.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1bea0c3e-2068-4f15-9701-fbd2cc5d8c41o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Add custom build to Android studio emulator

Frank Yang
For creating an AVD off your platform build, currently there aren't good happy paths for it yet (we're working on it). A stopgap solution is to setup some default AVD in Studio (doesn't matter what the name is, let's call it 'someAvd' for now), note the path to the system image in $ANDROID_SDK_ROOT/system-images/..../x86 or x86_64, in ~/.android/avd/someAvd.avd/config.ini

Then, we can produce a img.zip in the Android build tree that contains a set of files that can replace the files in any $ANDROID_SDK_ROOT/system-images/..../x86, x86_64 folder:

echo $ANDROID_PRODUCT_OUT
MYPACKEDIMG=$1

mkdir -p $MYPACKEDIMG/img
rm -rf $MYPACKEDIMG/img/*
cd $MYPACKEDIMG/img
cp $ANDROID_PRODUCT_OUT/system-qemu.img system.img
cp $ANDROID_PRODUCT_OUT/vendor-qemu.img vendor.img
cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img
if [ -f $ANDROID_PRODUCT_OUT/kernel-ranchu-64 ]; then
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu-64 kernel-ranchu-64
else
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu kernel-ranchu
fi;
cp -rf $ANDROID_PRODUCT_OUT/data .
cp -rf $ANDROID_PRODUCT_OUT/advancedFeatures.ini advancedFeatures.ini
cp -rf $ANDROID_PRODUCT_OUT/userdata.img .
cp -rf $ANDROID_PRODUCT_OUT/encryptionkey.img .
cp -rf $ANDROID_PRODUCT_OUT/system/build.prop .
cp -rf $ANDROID_PRODUCT_OUT/VerifiedBootParams.textproto .
cp -rf $ANDROID_PRODUCT_OUT/source.properties .

cd ..
zip -1rq img.zip img/*
ls -l img.zip

After replacing the files there, wiping AVD data and launching the AVD 'someAvd' from Studio should work.

On Wed, Aug 5, 2020 at 7:50 AM Bastien Chanot <[hidden email]> wrote:
Hi everyone ! I hope you are all good =)

I am talking to you today for asking you something. I don't find any answer on internet, so maybe some of you got it !

I just built a AOSP build, successfully, and i wish to add it to my android studio emulator. (on Ubuntu !)

I tried to follow the link https://source.android.com/setup/create/avd, i followed the process correctly, added the link ( like this file:///home/bchanot/Custom/repo-sys-img.xml)
But when i am trying to create an AVD through the Android Virtual Device software, i cannot find the image i specified in link.

Can someone help me ?

Thanks for all and sorry if i am not clear enough, ask me some questions !

Best regards,
Bastien.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1bea0c3e-2068-4f15-9701-fbd2cc5d8c41o%40googlegroups.com.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/CAEkmjvXb1V9-FbRN3aamy54BxAXPHroUZvWPfOx%2BseR%3D1hX26w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Add custom build to Android studio emulator

Frank Yang
There are also scripts in AAOS that might help but may need to be adapted to the general case:


On Wed, Aug 5, 2020 at 9:04 AM Frank Yang <[hidden email]> wrote:
For creating an AVD off your platform build, currently there aren't good happy paths for it yet (we're working on it). A stopgap solution is to setup some default AVD in Studio (doesn't matter what the name is, let's call it 'someAvd' for now), note the path to the system image in $ANDROID_SDK_ROOT/system-images/..../x86 or x86_64, in ~/.android/avd/someAvd.avd/config.ini

Then, we can produce a img.zip in the Android build tree that contains a set of files that can replace the files in any $ANDROID_SDK_ROOT/system-images/..../x86, x86_64 folder:

echo $ANDROID_PRODUCT_OUT
MYPACKEDIMG=$1

mkdir -p $MYPACKEDIMG/img
rm -rf $MYPACKEDIMG/img/*
cd $MYPACKEDIMG/img
cp $ANDROID_PRODUCT_OUT/system-qemu.img system.img
cp $ANDROID_PRODUCT_OUT/vendor-qemu.img vendor.img
cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img
if [ -f $ANDROID_PRODUCT_OUT/kernel-ranchu-64 ]; then
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu-64 kernel-ranchu-64
else
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu kernel-ranchu
fi;
cp -rf $ANDROID_PRODUCT_OUT/data .
cp -rf $ANDROID_PRODUCT_OUT/advancedFeatures.ini advancedFeatures.ini
cp -rf $ANDROID_PRODUCT_OUT/userdata.img .
cp -rf $ANDROID_PRODUCT_OUT/encryptionkey.img .
cp -rf $ANDROID_PRODUCT_OUT/system/build.prop .
cp -rf $ANDROID_PRODUCT_OUT/VerifiedBootParams.textproto .
cp -rf $ANDROID_PRODUCT_OUT/source.properties .

cd ..
zip -1rq img.zip img/*
ls -l img.zip

After replacing the files there, wiping AVD data and launching the AVD 'someAvd' from Studio should work.

On Wed, Aug 5, 2020 at 7:50 AM Bastien Chanot <[hidden email]> wrote:
Hi everyone ! I hope you are all good =)

I am talking to you today for asking you something. I don't find any answer on internet, so maybe some of you got it !

I just built a AOSP build, successfully, and i wish to add it to my android studio emulator. (on Ubuntu !)

I tried to follow the link https://source.android.com/setup/create/avd, i followed the process correctly, added the link ( like this file:///home/bchanot/Custom/repo-sys-img.xml)
But when i am trying to create an AVD through the Android Virtual Device software, i cannot find the image i specified in link.

Can someone help me ?

Thanks for all and sorry if i am not clear enough, ask me some questions !

Best regards,
Bastien.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1bea0c3e-2068-4f15-9701-fbd2cc5d8c41o%40googlegroups.com.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/CAEkmjvU_VYfbZWXu1yqeQT%2BqeeQj3X-oLJcKhdNHivgNKnhnXA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Add custom build to Android studio emulator

utzcoz
My code bases on AOSP 10. If I change the ramdisk part of above script with following content:

if [ -f $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ]; then

cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img

else

cp $ANDROID_PRODUCT_OUT/ramdisk.img ramdisk.img
fi;

it will work for me. Thanks @Lingfeng Yang.

Another thing, if there doesn't exist source.properties, we can copy it from current AVD instance,
or execute "make sdk" to generate it to out/host directory.
On Thursday, August 6, 2020 at 12:10:37 AM UTC+8 Lingfeng Yang wrote:
There are also scripts in AAOS that might help but may need to be adapted to the general case:


On Wed, Aug 5, 2020 at 9:04 AM Frank Yang <[hidden email]> wrote:
For creating an AVD off your platform build, currently there aren't good happy paths for it yet (we're working on it). A stopgap solution is to setup some default AVD in Studio (doesn't matter what the name is, let's call it 'someAvd' for now), note the path to the system image in $ANDROID_SDK_ROOT/system-images/..../x86 or x86_64, in ~/.android/avd/someAvd.avd/config.ini

Then, we can produce a img.zip in the Android build tree that contains a set of files that can replace the files in any $ANDROID_SDK_ROOT/system-images/..../x86, x86_64 folder:

echo $ANDROID_PRODUCT_OUT
MYPACKEDIMG=$1

mkdir -p $MYPACKEDIMG/img
rm -rf $MYPACKEDIMG/img/*
cd $MYPACKEDIMG/img
cp $ANDROID_PRODUCT_OUT/system-qemu.img system.img
cp $ANDROID_PRODUCT_OUT/vendor-qemu.img vendor.img
cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img
if [ -f $ANDROID_PRODUCT_OUT/kernel-ranchu-64 ]; then
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu-64 kernel-ranchu-64
else
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu kernel-ranchu
fi;
cp -rf $ANDROID_PRODUCT_OUT/data .
cp -rf $ANDROID_PRODUCT_OUT/advancedFeatures.ini advancedFeatures.ini
cp -rf $ANDROID_PRODUCT_OUT/userdata.img .
cp -rf $ANDROID_PRODUCT_OUT/encryptionkey.img .
cp -rf $ANDROID_PRODUCT_OUT/system/build.prop .
cp -rf $ANDROID_PRODUCT_OUT/VerifiedBootParams.textproto .
cp -rf $ANDROID_PRODUCT_OUT/source.properties .

cd ..
zip -1rq img.zip img/*
ls -l img.zip

After replacing the files there, wiping AVD data and launching the AVD 'someAvd' from Studio should work.

On Wed, Aug 5, 2020 at 7:50 AM Bastien Chanot <[hidden email]> wrote:
Hi everyone ! I hope you are all good =)

I am talking to you today for asking you something. I don't find any answer on internet, so maybe some of you got it !

I just built a AOSP build, successfully, and i wish to add it to my android studio emulator. (on Ubuntu !)

I tried to follow the link https://source.android.com/setup/create/avd, i followed the process correctly, added the link ( like this file:///home/bchanot/Custom/repo-sys-img.xml)
But when i am trying to create an AVD through the Android Virtual Device software, i cannot find the image i specified in link.

Can someone help me ?

Thanks for all and sorry if i am not clear enough, ask me some questions !

Best regards,
Bastien.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1bea0c3e-2068-4f15-9701-fbd2cc5d8c41o%40googlegroups.com.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/cf8acbe3-f155-434c-91e2-0270ee84fe1dn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Add custom build to Android studio emulator

Bastien Chanot
Hi again !
Link you gave me Lingfend Was usefull !

I just have a question, it seems to work only for build for 8.1 or after.
Do you know how to do it with 7.1 version ?

Because it missing a lot of file ^^" :
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/system-qemu.img': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/vendor-qemu.img': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/kernel-ranchu': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/encryptionkey.img': No such file or directory
  • cp: cannot stat '/external/AOSP_7/device/generic/goldfish/data/etc/userdata.img': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/VerifiedBootParams.textproto': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/config.ini': No such file or directory
  • cp: cannot stat '/external/AOSP_7/out/target/product/generic_x86_64/advancedFeatures.ini': No such file or directory

Thanks for your answers !
Have a great day.
Best regards, Bastien
Le samedi 12 septembre 2020 à 21:13:19 UTC+2, [hidden email] a écrit :
My code bases on AOSP 10. If I change the ramdisk part of above script with following content:

if [ -f $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ]; then

cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img

else

cp $ANDROID_PRODUCT_OUT/ramdisk.img ramdisk.img
fi;

it will work for me. Thanks @Lingfeng Yang.

Another thing, if there doesn't exist source.properties, we can copy it from current AVD instance,
or execute "make sdk" to generate it to out/host directory.
On Thursday, August 6, 2020 at 12:10:37 AM UTC+8 Lingfeng Yang wrote:
There are also scripts in AAOS that might help but may need to be adapted to the general case:


On Wed, Aug 5, 2020 at 9:04 AM Frank Yang <[hidden email]> wrote:
For creating an AVD off your platform build, currently there aren't good happy paths for it yet (we're working on it). A stopgap solution is to setup some default AVD in Studio (doesn't matter what the name is, let's call it 'someAvd' for now), note the path to the system image in $ANDROID_SDK_ROOT/system-images/..../x86 or x86_64, in ~/.android/avd/someAvd.avd/config.ini

Then, we can produce a img.zip in the Android build tree that contains a set of files that can replace the files in any $ANDROID_SDK_ROOT/system-images/..../x86, x86_64 folder:

echo $ANDROID_PRODUCT_OUT
MYPACKEDIMG=$1

mkdir -p $MYPACKEDIMG/img
rm -rf $MYPACKEDIMG/img/*
cd $MYPACKEDIMG/img
cp $ANDROID_PRODUCT_OUT/system-qemu.img system.img
cp $ANDROID_PRODUCT_OUT/vendor-qemu.img vendor.img
cp $ANDROID_PRODUCT_OUT/ramdisk-qemu.img ramdisk.img
if [ -f $ANDROID_PRODUCT_OUT/kernel-ranchu-64 ]; then
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu-64 kernel-ranchu-64
else
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu kernel-ranchu
fi;
cp -rf $ANDROID_PRODUCT_OUT/data .
cp -rf $ANDROID_PRODUCT_OUT/advancedFeatures.ini advancedFeatures.ini
cp -rf $ANDROID_PRODUCT_OUT/userdata.img .
cp -rf $ANDROID_PRODUCT_OUT/encryptionkey.img .
cp -rf $ANDROID_PRODUCT_OUT/system/build.prop .
cp -rf $ANDROID_PRODUCT_OUT/VerifiedBootParams.textproto .
cp -rf $ANDROID_PRODUCT_OUT/source.properties .

cd ..
zip -1rq img.zip img/*
ls -l img.zip

After replacing the files there, wiping AVD data and launching the AVD 'someAvd' from Studio should work.

On Wed, Aug 5, 2020 at 7:50 AM Bastien Chanot <[hidden email]> wrote:
Hi everyone ! I hope you are all good =)

I am talking to you today for asking you something. I don't find any answer on internet, so maybe some of you got it !

I just built a AOSP build, successfully, and i wish to add it to my android studio emulator. (on Ubuntu !)

I tried to follow the link https://source.android.com/setup/create/avd, i followed the process correctly, added the link ( like this file:///home/bchanot/Custom/repo-sys-img.xml)
But when i am trying to create an AVD through the Android Virtual Device software, i cannot find the image i specified in link.

Can someone help me ?

Thanks for all and sorry if i am not clear enough, ask me some questions !

Best regards,
Bastien.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1bea0c3e-2068-4f15-9701-fbd2cc5d8c41o%40googlegroups.com.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/411ab6ea-c4f7-4159-bff2-8c6a7f6cca12n%40googlegroups.com.