Install Google Apps on AOSP Build

前端 未结 4 1128
广开言路
广开言路 2021-02-03 10:33

I have installed android-6.0.1_r72 AOSP Rom on a Nexus 5 device. The rom doesn\'t come with Google Apps.

I\'ve tried to install from the follow

相关标签:
4条回答
  • 2021-02-03 11:09

    andDevW's answer covers the details.

    Adding another way to do the second step. Instead of FLASHing FACTORY IMAGE AND PULL GENUINE GOOGLE APK,

    you can use simg2img to convert the system.img file into a mountable volume

    1. Use simg2img to convert your .img file into .raw file
    simg2img /home/<user>/../aosp/../out/system.img system.raw
    
    1. mount the raw file as an ext4 external file system volume
    sudo mount -t ext4 -o loop system.raw /system
    

    you will be able to navigate your system.raw image once mounted and you can access /priv-app and other directories to get the apks you need, in the mounted volume at /system.

    You can use this to get apks from system.img in factory image releases from Google.

    0 讨论(0)
  • 2021-02-03 11:11

    Three things you are doing wrong:
    1. You generally need to install APK pulled from the same version of Android that you want to run.
    2. Don't ever download Google APK from non-Google sites.
    3. In order to install system apps you need to first remount the system partition as read-write.

    Here's how to get and then install genuine Google APK as system apps:

    USE YOUR AOSP BUILD NUMBER TO GET THE MATCHING FACTORY IMAGE
    The link you provided for AOSP Codenames, Tags, and Build Numbers has build numbers that you need to match. Search the page for android-6.0.1_r72 and the corresponding build number is M4B30X.

    Instead of using untrusted APK from random sites (a terrible idea) you can obtain genuine APK directly from the good folks at Google with the help of their Factory Images. Search the page for your build number M4B30X and download the image. Next, cd into the folder where you downloaded the image and run a check on the SHA-256 Checksum:

    $ cd Downloads
    
    $ echo "10cfaa5c8ff1753af20283f5e5f938ddebbad094c4e22aadbd925ecdc806e8b3   
      hammerhead-m4b30x-factory-10cfaa5c.zip" | sha256sum -c
    

    It should print: hammerhead-m4b30x-factory-10cfaa5c.zip: OK
    -If not, download the image again.

    FLASH FACTORY IMAGE AND PULL GENUINE GOOGLE APK
    1. Flash the Factory Image and boot into the system.
    2. Activate Developer options and allow 'USB Debugging'
    3. Now use ADB to pull(get) the 100% genuine Google Play APK:

    $ adb pull /system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk
    $ adb pull /system/priv-app/Phonesky/Phonesky.apk
    $ adb pull /system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk
    

    FLASH AOSP HAMMERHEAD M4B30X AND PUSH GENUINE GOOGLE APK
    Make sure that you flash either the userdebug or eng variant.

    Push APK files to your sdcard:

    $ adb push GoogleServicesFramework.apk /sdcard/
    $ adb push Phonesky.apk /sdcard/
    $ adb push PrebuiltGmsCore.apk /sdcard/
    

    MANUALLY INSTALL APK AS SYSTEM APPS

    $ sudo adb shell
    

    Locate system partition: root@hammerhead:/ # mount | grep "/system" You should get back: /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0

    Now mount that system partition as rw(read-write)

    root@hammerhead:/ # mount -o remount,rw -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system 
    
    root@hammerhead:/ # cd /system/priv-app   
    root@hammerhead:/ # mkdir GoogleServicesFramework
    root@hammerhead:/ # mkdir Phonesky
    root@hammerhead:/ # mkdir PrebuiltGmsCore
    
    root@hammerhead:/ # cp /sdcard/GoogleServicesFramework.apk GoogleServicesFramework/GoogleServicesFramework.apk
    root@hammerhead:/ # cp /sdcard/Phonesky.apk Phonesky/Phonesky.apk
    root@hammerhead:/ # cp /sdcard/PrebuiltGmsCore.apk PrebuiltGmsCore/PrebuiltGmsCore.apk
    
    root@hammerhead:/ # chmod 755 GoogleServicesFramework
    root@hammerhead:/ # chmod 755 Phonesky
    root@hammerhead:/ # chmod 755 PrebuiltGmsCore
    
    root@hammerhead:/ # chmod 644 GoogleServicesFramework/GoogleServicesFramework.apk
    root@hammerhead:/ # chmod 644 Phonesky/Phonesky.apk
    root@hammerhead:/ # chmod 644 PrebuiltGmsCore/PrebuiltGmsCore.apk
    

    CONFIGURE AOSP

    Grant Google Apps Permissions
    On your phone, go into Settings>Apps In the overflow menu (gear button upper right corner)
    Select Show system
    Navigate down to Google Play Store and allow it all of the permissions.
    Do the same for Google Services Framework and Google Play Services (PrebuiltGmsCore).
    Now make sure ALL of the default AOSP apps have their respective permissions granted.
    AOSP by default comes with many permissions turned off.
    Allow ALL permissions for the following apps:
    Android Keyboard
    Browser
    Calendar
    Camera
    Clock
    Contacts
    Email
    Gallery
    Launcher3
    Messaging
    Music
    Phone

    *And the ever-janky looking Search, if for some reason you don't want to disable it.

    Now make sure that Wifi is connected and/or your SIM card is in and providing signal.
    Reboot.
    You should have some brief errors as everything gets sorted, although if the errors continue, another reboot should fix it.

    0 讨论(0)
  • 2021-02-03 11:11

    The error you are getting is related to Runtime permissions, which is a concept introduced in Android API level 23 (Marshmallow onwards). Prior to this, all the permissions that an Application required where provided during installation implicitly by the user i.e. you are agreeing to give the necessary permissions to the app by installing it.

    Google overhauled this. From API level 23 onward, not only an app has to declare all the permissions it needs in manifest but if any of these permissions are categorized as DANGEROUS then application has to request for it at runtime. How an application has to do this - https://developer.android.com/training/permissions/requesting.html

    I explained all these just to give you a context. In your case, the problem is that the applications you are trying to install were not designed to run on API level 23 or above. When you installed them they were not implicitly given some permissions, and since the applications are not requesting for them at runtime, finally they are ending up without the necessary permission to do certain thing (in your case access the device location).

    Long story short, try to find a version of the application designed for Marshmallow and upward. Unfortunately Google made this change in a way that it restricts backward compatibility to some extent. So you can't escape. Find a newer version

    0 讨论(0)
  • 2021-02-03 11:22

    It depends on purpose of these apps in your AOSP.

    I might be wrong, but in order to install Google Play Service based apps for a custom device it's required to sign an agreement with Google and pass all the verification tests.

    0 讨论(0)
提交回复
热议问题