[GUIDE][NON-ROOT] Google Assistant for Marshmallow (no build.prop editing)

Search This thread
Oct 10, 2015
47
43
calcutta
EDIT: Version 6.9 onwards, the methods are moved to somewhere else. I haven't found them yet due to exams.

So, last week a news struck android users viciously- the new much awaited Google assistant will be pixel specific only. But developers have already managed to get assistant on any nougat phone by editing the build.prop. But users have reported that camera and some other apps aren't working properly.

Today, I tried to decompile and remove from Google app the check for pixel device. I have got it working on my android one running Resurrection Remix 6.0.1.
I'll give here the steps.
DISCLAIMER- I won't be responsible for your bricked device. I tried it and it worked. Doesn't mean it will work for you too. Keep the original apk ready so that you can revert back in case anything happens.
What is working
  1. Voice recognition
  2. chats
  3. Navigation etc.

What isn't working
  1. The "OK Google" hotword detection is not working. It tells you to train your voice model everytime.

Requirements
  1. apktool (make sure you have set it up properly)
  2. A smali editor ( Notepad++ for Windows, I used kate on Linux)
  3. patience
  4. Android build tools (adb and zipalign)

Let's start

1. First we need the Google apk. Make sure you have upgraded to the latest ( mine was 6.8.21.21). Copy the file to your PC. Name it Google.apk

2. Open up a terminal in Linux (in Windows, navigate to the folder where apktool is located, and shift+right click on a blank space and click "open command prompt here"). If you're on Linux, make sure apktool is in your PATH.
Type
Code:
apktool d Google.apk
This should create a folder called "Google"

3. Open Google/smali/com/google/android/apps/gsa/assistant/a/e.smali file with your preferred editor.

4. Look for a method called pU() like this-
Code:
.method public static pU()Z
    .locals 3

    .prologue
    const/4 v0, 0x1

    .line 97
    invoke-static {}, Lcom/google/android/libraries/e/a/a;->aY()Z

    move-result v1

    .line 2188
............
change the
Code:
const/4 v0, 0x0
to
Code:
const/4 v0, 0x1

Repeat the same process with another method called pT()
If you can't find them in the path I provided, then look for something like this "ro.opa.eligible_device" inside an "if-neq" or "if-eqz". If you find this, then that is probably the required method.

5. Return to the root directory (where the Google directory is located) and type
Code:
apktool b Google

6. The app should be ready in Google/dist directory. Move to there and copy the Original apk.

7. Open the original apk with a zip viewer (winrar or 7zip, I used ark). Extract the META-INF folder to the directory.

8. Open the modified apk with the zip viewer . Don't extract it. Just drag and drop the META-INF folder on the apk. Make sure you have the compression option as "store"

9. Now install this app. Some people reported that it does not install from the device. I never tried to install it from my phone. I actually installed it via adb and it worked. type-
Code:
adb install -r Google.apk

10. Wipe the data of the Google app from settings. No need to reboot. :p:p

Attachment: Assistant running on my phone with screen search

Guys, try this and let me know if it works or not.
 

Attachments

  • Screenshot_20161011-232932.png
    Screenshot_20161011-232932.png
    23.1 KB · Views: 30,303
  • Screenshot_20161011-233040.png
    Screenshot_20161011-233040.png
    30.5 KB · Views: 30,095
Last edited:

yashgumaste

Senior Member
Dec 20, 2014
439
63
26
Working on RR rom for moto g2 xt1068.
Surprisingly even OK Google is working.
No lag. I have one question tho: Is it he or she? What is his/her name? I rather called her Alia (bollywood guys would understand)
 
  • Like
Reactions: TheClashster

rpravenclaw

Senior Member
May 10, 2015
151
46
Bengaluru
linktr.ee
Hey this looks awesome! So I just need to install your mod apk or do I still have to replace the META_INF from original apk? Also, can you guide me with the installation from phone terminal? Beacuse my PC has adb problems. Thanks!
 
  • Like
Reactions: Bibhuranjan goswami
Oct 10, 2015
47
43
calcutta
I wasn't able to get it working on my HTC One M8. When I tried to install your pre-compiled APK, I was met with an error: [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]. I also tried to follow your directions to edit the APK myself, but apktool apparently ran into a lot of errors and wasn't able to compile it.
I wish I could tell you more, but I don't know much about the working of APKs, and I've never even used apktool before.

Have you installed the framework and set up apktool properly? There's guides on how to do it on XDA
 
Oct 10, 2015
47
43
calcutta
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 34
    EDIT: Version 6.9 onwards, the methods are moved to somewhere else. I haven't found them yet due to exams.

    So, last week a news struck android users viciously- the new much awaited Google assistant will be pixel specific only. But developers have already managed to get assistant on any nougat phone by editing the build.prop. But users have reported that camera and some other apps aren't working properly.

    Today, I tried to decompile and remove from Google app the check for pixel device. I have got it working on my android one running Resurrection Remix 6.0.1.
    I'll give here the steps.
    DISCLAIMER- I won't be responsible for your bricked device. I tried it and it worked. Doesn't mean it will work for you too. Keep the original apk ready so that you can revert back in case anything happens.
    What is working
    1. Voice recognition
    2. chats
    3. Navigation etc.

    What isn't working
    1. The "OK Google" hotword detection is not working. It tells you to train your voice model everytime.

    Requirements
    1. apktool (make sure you have set it up properly)
    2. A smali editor ( Notepad++ for Windows, I used kate on Linux)
    3. patience
    4. Android build tools (adb and zipalign)

    Let's start

    1. First we need the Google apk. Make sure you have upgraded to the latest ( mine was 6.8.21.21). Copy the file to your PC. Name it Google.apk

    2. Open up a terminal in Linux (in Windows, navigate to the folder where apktool is located, and shift+right click on a blank space and click "open command prompt here"). If you're on Linux, make sure apktool is in your PATH.
    Type
    Code:
    apktool d Google.apk
    This should create a folder called "Google"

    3. Open Google/smali/com/google/android/apps/gsa/assistant/a/e.smali file with your preferred editor.

    4. Look for a method called pU() like this-
    Code:
    .method public static pU()Z
        .locals 3
    
        .prologue
        const/4 v0, 0x1
    
        .line 97
        invoke-static {}, Lcom/google/android/libraries/e/a/a;->aY()Z
    
        move-result v1
    
        .line 2188
    ............
    change the
    Code:
    const/4 v0, 0x0
    to
    Code:
    const/4 v0, 0x1

    Repeat the same process with another method called pT()
    If you can't find them in the path I provided, then look for something like this "ro.opa.eligible_device" inside an "if-neq" or "if-eqz". If you find this, then that is probably the required method.

    5. Return to the root directory (where the Google directory is located) and type
    Code:
    apktool b Google

    6. The app should be ready in Google/dist directory. Move to there and copy the Original apk.

    7. Open the original apk with a zip viewer (winrar or 7zip, I used ark). Extract the META-INF folder to the directory.

    8. Open the modified apk with the zip viewer . Don't extract it. Just drag and drop the META-INF folder on the apk. Make sure you have the compression option as "store"

    9. Now install this app. Some people reported that it does not install from the device. I never tried to install it from my phone. I actually installed it via adb and it worked. type-
    Code:
    adb install -r Google.apk

    10. Wipe the data of the Google app from settings. No need to reboot. :p:p

    Attachment: Assistant running on my phone with screen search

    Guys, try this and let me know if it works or not.
    6
    I'd like to provide some update for this method for Google 6.9.36

    Instead of Google/smali/com/google/android/apps/gsa/assistant/a/e.smali use Google/smali/com/google/android/apps/gsa/assistant/shared/f.smali
    Instead of pU() look for rp()
    Instead of pT() look for ro()

    Also, if you want to disable annoying voice training screen (why wouldn't you :) ), do this:

    Open Google/smali/com/google/android/apps/gsa/opa/ae.smali
    Look for method containing from_hotword , currently it's y(Landroid/os/Bundle;)
    Replace const/4 v0, 0x1 with const/4 v0, 0x0 in this method

    Do other steps mentioned in OP and enjoy your Google Assistant with OK Google without any annoying extra screens ;)

    P.S.
    You should train "OK Google" voice model with regular Google App installed first, and only then install modified apk, if you want voice recognition to work
    5
    So finally I got this right, or so I think. I'm using apktool v2.2.1 (Google it, you shall find).

    Here we go,
    1. Decompile the apk, e.g. Google.apk or Velvet.apk, you name it.
    Code:
    >apktool d -r Google.apk
    2. Do your stuff editing the smali file.
    3. Recompile the folder.
    Code:
    >apktool b -c Google
    4. Use 7zip to open both original apk and the edited output apk in /Google/dist.
    5. Copy (drag and drop) both META-INF folder and AndroidManifest.xml file from the original apk to the edited output apk.
    6. Close both files (duh!).
    7. Transfer the final edited output apk to your phone /system/priv-app/ and give correct permission (-rw-r--r--). Make sure you get rid of the old Google app from your phone before doing this.
    8. Reboot and profit!

    9. Press the thanks button whether it works or doesn't work for you.

    Edit: Step 4 to 8 is not needed. Just use the apk file in /Google/dist folder, transfer it to your phone sdcard and tap it to install as user app. Clear app data if needed. Done.
    3
    Crap, the latest Google app apk has changed again the file structure. It's neither in the OP place nor in the updated place for 6.9.36
    @Sabissimo to the rescue!

    http://forum.xda-developers.com/and...e-assistant-marshmallow-t3478450/post70048195
    3
    peoples are reporting that using n-ify xposed module they are able to use google assitant http://forum.xda-developers.com/xposed/modules/xposed-android-n-ify-features-t3345091/page1093 have a look

    will test in sometime.

    Yes, N-ify also has the same issues as me. Their method is also similar as mine. But mine should work for non rooted users also.