2

I lost all my source code due to an error. I had already loaded the apk of a version of my app on my Glass. How can I get the apk of my app off my Glass so I can decompile it?

I tried the command below:

./adb pull /data/app/myapp.apk

But it didn't work. Any other approaches?

Zach Johnson
  • 23,678
  • 6
  • 69
  • 86
uLYsseus
  • 995
  • 6
  • 16
  • 37
  • I have adjusted the question that was originally written by the author so it makes sense .. can folks remove the hold please?! – ErstwhileIII Mar 13 '14 at 14:25
  • "pull" copies something *from* the device. "push" copies something *to* the device. Also whenever you write "it's not working", always specify what you mean. – Sean Owen Mar 13 '14 at 16:51
  • If what you are asking is how to install a program (apk). First, make sure debug mode is ON on Glass. Connect Google Glass to USB in your computer. run "adb devices" to make sure it is connected. Then, run "adb install -r myapp.apk" – Hendrix Mar 14 '14 at 04:50
  • Can we remove the hold on this question? – ErstwhileIII Mar 14 '14 at 13:40
  • @ErstwhileIII, I voted to reopen, but rolled back since the original question was different than the edited one (wanting to get an apk off Glass, rather than install an apk on it.) – Zach Johnson Mar 14 '14 at 19:31
  • You may want to look at this older StackOverflow question http://stackoverflow.com/questions/4032960/how-do-i-get-an-apk-file-from-an-android-device – ErstwhileIII Mar 14 '14 at 22:42

1 Answers1

2

You have to have the Glass rooted in order to retrieve the APK's you already installed (just like on your phone), however you are in a catch 22 I believe because if I remember correctly in rooting it you'll be doing a factory reset.

Zach Johnson
  • 23,678
  • 6
  • 69
  • 86
Sean
  • 179
  • 7
  • I guess I have to go with this one.....! But a lesson taught in a hard way, I thought I would have access to /data/app on glass as I had it on my nexus device without root. But no its not, so for anybody coming over to this question, you cannot access the /data/app on your glass unless its rooted from my experience. – uLYsseus Mar 12 '14 at 20:29
  • Yeah I had tried to grab something from the /data and wasn't able to access it, however I also have a nexus device (nexus 5) and am not able to access /data without root (at least using a file explorer on the device) – Sean Mar 12 '14 at 20:40
  • 1
    You do not need to root the device unless Android has changed. The last time I looked (a while ago), /data/app had permission 0711, which means you can pull apk's from it just fine but you cannot read the directory to discover the name (and Android has a habit of renaming them to have name-1.apk, name-2.apk, etc.). There is an API though to determine the stored name of a given application. – mah Mar 12 '14 at 20:55
  • Strange, I wonder why root explorer can't access it on a non-rooted device – Sean Mar 12 '14 at 20:57
  • Load into Chrome the application ChromeADB (from Chrome store). You can load and unload applications that way. Your device does NOT need to be rooted, just turn debug mode on – ErstwhileIII Mar 12 '14 at 23:40