Android apps

WARNING!

These instructions have been compiled from various internet sources, and are intended to be used with apps either where the license permits modification or where permission for modification has been granted by the rights-owner. You bear sole responsibility for determining whether such modification is allowed or permission is needed. Even if permitted, modification may result in a loss of tech support. We expressly disclaim any and all liability and consequences (including damage to your device) that may arise, either directly or indirectly, from following or attempting to follow these instructions.

Modifying Android apps to support Reedah involves several steps: (a) obtaining the app, (b) unpacking it, (c) modifying it, (d) packing and signing it, (e) installing it.

Step 1: Obtaining the app

You need a copy of the app on your PC (Windows or Linux). Two ways to obtain it:

  • Download it directly from the web. For example, you can get gReader from GitHub, or
  • Install it on your device using Google Play, and copy the APK file from there. For example, gReader will be stored as /data/app/com.noinnion.android.greader.reader-1.apk.

Step 2: Unpacking the app

For this step, you will need the following:

  • A tool for zipping and unzipping (e.g. PeaZip, WinZip, WinRAR).
  • The Java Development Kit (JDK). This process reportedly works best with JDK 6.
  • Smali and Baksmali, available from Google Code.
Once you have these prerequisites, then:
  • Open the APK file (app) using PeaZip and extract the classes.dex file.
  • In a Windows command prompt (or Linux shell), type:
    java -jar baksmali-2.0b6.jar -o classout/ classes.dex
    This assumes Java is in your path; Windows users might need to type (e.g.)
    set PATH=%PATH%;"c:\program files\java\jdk1.6.0_45\bin"
    If you downloaded different versions of JDK/baksmali, adjust the filenames accordingly.

Step 3: Modifying the app

Modifying the app involves replacing all pointers to Google Reader (or other alternatives) with pointers to Reedah. For most Android apps, you can do this using find-and-replace in a text editor like Notepad or Wordpad.

While the concept and process is simple, there are two challenges:

  • Exactly what text should you use for the find and replace? If the app uses TheOldReader (which applies to gReader versions since July):
    • Replace all occurrences of "theoldreader.com" with "www.reedah.com".
    • Additionally, because TheOldReader is not compliant with the Google Reader API, you should find "?output=json" and replace with "?output=json&client=tor". In this case, the quotes should be included in the find.
    For apps that still point to Google Reader:
    • Replace all URLs containing "google.com" with "reedah.com".
    • Do not replace non-URLs. In other words, you should replace anything that looks like http://www.google.com or http://google.com, but not tag:google.com or state/com.google.
  • The classout directory (created during Step 2) will contain many files, and only a few of them will need to be modified - which ones? For gReader, try these two:
    com/noinnion/android/greader/reader/client/OldReaderClient.smali
    com/noinnion/android/greader/reader/client/OldReaderLoginActivity.smali
    
    For other apps, you could try searching for "a word or phrase in the file" (Windows) or use the "grep" command (Linux).

Step 4: Packing and signing the app

  • Re-pack the classes.dex file:
    java -Xmx512M -jar smali-2.0b6.jar classout/ -o classes.dex
  • Open the APK file in PeaZip. Delete the META-INF directory from the archive, and update the archive with the modified classes.dex file.
  • Create a key for signing the app:
    keytool -genkey -v -keystore my-reedah-key.keystore -alias myreedahkey -keyalg RSA -keysize 2048 -dname "CN=Android Reedah,O=Android Reedah,C=US" -validity 10000
    You will be prompted to create a password; choose whatever you want (e.g. "android").
  • Sign the app:
    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-reedah-key.keystore -signedjar MY_REEDAH_APP.apk XXXX.apk myreedahkey
    Here, you will need to replace XXXX.apk with the name of the modified APK. You will be asked for the password you created in the previous command. This will create MY_REEDAH_APP.apk, which is the app you're going to install on your Android device.

Step 5: Installing the app

  • Before installing the app, you should make sure the security settings on your device will not prevent it. Go to Settings - Security, and be sure "Unknown sources" is checked. Also uninstall any unmodified versions of the app.
  • Copy the MY_REEDAH_APP.apk file to your device. The easiest way might be to put it on a web site (like dropbox) and download it using the Android browser.
  • If the APK shows up in your Downloads, simply click it to install.
The most common source of trouble will be residual data from the unmodified app. If you have problems installing, try opening a Terminal Emulator, type "su" and confirm. Then:
  • Look in /data/data and remove data from the unmodified app, e.g.
    rm -rf /data/data/com.noinnion.android.greader.reader-1
  • Download the app, e.g.
    wget -O /storage/sdcard0/MY_REEDAH_APP.apk http://dropbox.com/yourid/MY_REEDAH_APP.apk
  • Install the app, e.g.
    cd /storage/sdcard0 ; adb install MY_REEDAH_APP.apk
Now start the app. Note that it may still refer to Google Reader (or a replacement) even though it is using the Reedah backend.
RSS feed