You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何编辑PersonalDictionary.zip并重新导入Gboard?批量添加联系人姓名至个人词典

Fixing Gboard Personal Dictionary Edits & Batch-Adding Contact Names for Swipe Typing

Alright, let's tackle your questions one by one—since Gboard's personal dictionary has some hidden validation checks that trip up manual edits, we'll cover workarounds and reliable methods to make this work.

Why Won't Gboard Accept Your Edited Dictionary File?

You’re spot-on: Google runs strict validation on the PersonalDictionary.zip file. It checks things like file timestamps, the content hash of dictionary.txt, and even the zip’s internal structure. Just editing the text file and rezipping it almost always triggers this validation, which is why Gboard rejects the import.

How to Batch-Add Contact Names to Gboard's Personal Dictionary

If you want those contact names to pop up quickly during swipe typing, here are the most reliable methods:

Method 1: Batch Import via ADB (No Root Needed, No Validation Headaches)

This is the easiest, foolproof way to add tons of names at once:

  1. First, enable USB Debugging on your Android device and connect it to your computer.
  2. Extract all contact names from your address book:
    • Export your contacts as a .vcf file (most Android contact apps have this option in their settings)
    • Open the .vcf in a text editor, pull out all lines starting with FN: (these are the full names), and save them to a plain text file (names.txt) with one name per line.
  3. Use ADB commands to push each name to Gboard:
    • For Windows, create a batch file (add_names.bat) with this code:
      @echo off
      for /f %%i in (names.txt) do (
          adb shell am broadcast -a com.google.android.inputmethod.latin.dictionary.INSERT --es word "%%i"
      )
      
    • For Linux/macOS, use a shell script:
      while read name; do
          adb shell am broadcast -a com.google.android.inputmethod.latin.dictionary.INSERT --es word "$name"
      done < names.txt
      
    • Run the script, and all names will be added instantly. You can even add optional shortcuts (like initials) by appending --es shortcut "zs" to the command for faster swipe matches.

Method 2: Edit the Dictionary File & Bypass Validation (Requires Root)

If you really want to edit the dictionary.txt file directly, follow these steps:

  1. Export your current Gboard personal dictionary to get PersonalDictionary.zip.
  2. Unzip it, then open dictionary.txt—note the exact format (separated by tab characters, not spaces):
    Gboard Dictionary version:1

    [Word][Shortcut][Usage Count][Timestamp][Language Code]

  3. Append your contact names using the same format. For example:
    Maria Garcia<tab>mg<tab>1<tab>1700000000000<tab>en-US
    张三<tab>zs<tab>1<tab>1700000000000<tab>zh-CN
    
    The timestamp can be any current millisecond timestamp (look one up online), and the language code matches your input language.
  4. Rezip the file exactly as it was originally—no extra folders, just dictionary.txt in the zip root.
  5. If your device is rooted, push the modified file directly to Gboard's data folder:
    adb push dictionary.txt /data/data/com.google.android.inputmethod.latin/files/personal_dictionary/[your-language-code]/
    
    Restart Gboard (or your device) and the new words will show up. Without root, this method is hit-or-miss—Gboard will likely still reject the zip import, so stick with the ADB method instead.

Quick Note on Accessing Gboard's Personal Dictionary

To navigate to your dictionary settings on mobile: tap the keyboard settings icon → Text settings → Dictionary → Personal Dictionary (steps might vary slightly based on your device's UI).

Can You Add Words Manually on Desktop & Import to Mobile?

Yes, but with caveats:

  1. Gboard Desktop Sync: The simplest way is to use Gboard on your desktop (Windows/macOS), add words directly in its personal dictionary settings, then sync them to your phone via your Google account. No file editing needed—just make sure both devices are logged into the same account, and Gboard sync is enabled.
  2. Manual File Editing: If you want to edit the file on desktop and import it, you’ll need to use the ADB or root method mentioned earlier. Directly editing the zip and importing it to mobile will almost always fail due to Gboard's validation checks.

内容的提问来源于stack exchange,提问作者asif

火山引擎 最新活动