APKTool Decompiling Java Problem - Android Q&A, Help & Troubleshooting

I am having problems getting my APKTools to decompile an APK (I'm new to this). Here is my process:
- Downloaded the 3 apktool files and pasted them in the folder C:\APKTool
- Put framework-res.apk in the same folder
-Opened a command prompt in the folder C:\APKTool (Held shift and right clicked on folder)
- Typed "apktool if framework-res.apk"
I get the error:
'java' is not recognized as an internal or external command, operable program or batch file.
- I have the android SDK installed (everything in 32 bit, my eclipse works)
- I have installed the Java JDK in the same folder as the SDK
- Java Runtime environment 7 is installed in C:\Program Files (x86)\Java\jre7
I'm pretty stuck at this point. If it helps my operating system is windows 8 pro 64bit. Any ideas would be greatly appreciated.

Im stupid
Sorry I just reinstalled JRE and it worked fine. Wish I could go back in time before I posted this

Related

[Q] Some General Questions Regarding the editing of android.policy.jar

hello everyone
I have updated to kennethpenn's 4.5.91 Gingerbread Beta 4 (must say, it is truly a phenomally put together build !)
I have also noticed that many of the mods that i had applied to 1.8.3 have not been updated for 4.5.91, so i decided to make the changes myself.
Now, I have a pretty decent knowledge of Unix-based operating systems ( I have used Red Hat Linux, Ubuntu, SUSe Linux, OpenBSD, FreeBSD, Solaris, and now OS X) however, I would like to expand my knowledge to include Android.
The first one I attempted to do myself was the Wake on Volume Keys mod.
This is a very simple change to the android.policy.jar file, as you all well know.
For this, I used Windows XP, simply for the fact that I have 7zip and PeaZip installed on it. However, I can do all of this on OS X as well. The file archiver applications I have on OS X are:
1. The Unarchiver
2. Keka
I am going to list my method of applying this edit, and i would ask that someone with solid knowledge on this subject give me their feedback and guidance.
---------------------------------------------------------
My Method of editing android.policy.jar
---------------------------------------------------------
1. Using Root Explorer, I made a copy of /system/framework on my External SD Card
2. Mounting the Phone for USB Mass Storage on Windows XP that I have running in VirtualBox on my Macbook Pro, I moved the copy of the /system/framework directory to my Desktop
3. I downloaded smali-1.2.6.jar and baksmali-1.2.6.jar from code.google.com/p/smali/
4. I placed both of these .jar files in the copy of the framework-edited directory that I created on my Desktop
5. I renamed smali-1.2.6.jar to smali.jar and baksmali-1.2.6.jar to baksmali.jar for simplicity's sake
6. I moved the android.policy.jar file to /framework-edited directory on my Desktop
7. Using 7zip (I also have PeaZip, but for this, I used 7zip, if you think I should use PeaZip, please tell me) I extracted the files from android.policy.jar to end up with classes.dex and META-INF. I then moved classes.dex to /framework-edited so it is in the same directory as smali.jar and baksmali.jar
8. In Command Prompt, I entered:
Code:
cd C:\Documents and Settings\Owner\Desktop\framework-edited
in order to be working from the proper location where my files are located
9. Now, having Command Prompt working in the proper location, I entered the following commands:
Code:
java -jar baksmali.jar -o classout/ classes.dex
to create a new directory within /framework-edited called /framework-edited/classout
10. I then opened the /classout directory, and navigated to /classout/com/android/internal/policy/impl/ and opened the file KeyguardViewMediator.smali with Notepad
11. I used [Ctrl] + [F] to locate the line:
private isWakeKeyWhenKeyguardShowing(I)Z​
12. I then looked at the lines DIRECTLY below the above line, and following the Original Post on how to manually apply this modification, I removed lines:
0x18
0x19​
13. Upon removing these lines, I simply did a File -> Save As -> KeyguardViewMediator.smali and saved the file to my desktop
14. I [Cut] + [Pasted] the edited KeyguardViewMediator.smali file back to /classout/com/android/internal/policy/impl/ and replaced the original KeyguardViewMediator.smali file
15. With the edited KeyguardViewMediator.smali file in place, I went back to Command Prompt and entered the following commands:
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
To create a new file called new-classes.dex
16. Changing the name of new-classes.dex to classes.dex, I took the original META-INF file, and my newly created classes.dex files, and, using 7zip, created a new android.policy.zip archive
17. I renamed my newly created android.policy.zip to android.policy.jar, and transferred it to my External SD Card
18. Using Root Explorer, I navigated to /system/framework on my phone, and renamed android.policy.jar to 1122android.policy.jar.bac and [Copy] + [Pasted] my edited android.policy.jar to /system/framework
19. I then immediately powered off my phone, and rebooted into CWM Recovery, and cleared my Dalvik Cache, then rebooted the phone normally through CWM Recovery.
At this point, to my knowledge, I had successfully edited my android.policy.jar file and had manually added the Wake on Volume Keys modification, however, once the phone was fully booted and showing my lockscreen, I unlocked the phone as normal by sliding the slider to the right. As soon as the phone unlocked, I saw pop-ups for processes that had failed and were terminated. I'm not sure what the exact message the pop-ups had, but it was the normal pop-up message you get when a process force-closes. My only option was to click "Ok" so I clicked it, only to have another force-close pop-up.
Apparently, every single process on the phone had force-closed, BUT, the phone was waking when I press a volume key while the screen was off. I had no choice but to pull the battery out.
I decided to reboot into CWM Recovery and "install .zip from SD Card", Nottach's 1% Battery Mod / No Carrier Mod Uninstall Script
I installed Nottach's uninstall script because I hoped that it had an unmodified copy of android.policy.zip in it.
After installing the uninstall script, and rebooting the phone once again, I got to the lock screen, unlocked the phone, and found everything to be in perfect working order, just as before I edited anything,
But the Wake on Volume Keys mod was still applied!
So now, my questions / requests to all of you are:
1. Explain to me what I missed or did wrong that resulted in the force-closure of every single process on the phone prior to installing Nottach's Uninstall script
and
2. Educate me on the proper process that you developers use to apply small modifications such as this one to the android.policy.jar file, or any other related file on the phone for that matter.
My plan is now to change the color of the text on my lock screen (Clock, Date, and possibly Carrier) following this [Guide]
Any and all feedback is welcomed and greatly appreciated, as you will be helping me learn the beginnings of modding and developing
bump . . . . .
Perhaps this may help
http://forum.xda-developers.com/showthread.php?p=18226553

adb path issue on win7 64bit

I don't consider myself really a noob, but this time I just cannot stand myself. I've been working on it for at least a few hours and used google extensively but I cannot find what I'm doing wrong. The screenshot illustrates it. What I've tried:
Installed android SDK in "program files (x86)" and in "c:" root
Tried various paths, with and without quotation marks
Tried paths with and without trailing backslashes
Tried paths with forward slashes
I'm probably missing something totally obvious but I just cannot seem to find the problem. I'm on windows 7 home premium 64bit.
Edit: XDA trashes the screenshot, so a link to the file my dropbox and a code dump added.
Code:
C:\Users\xxxx>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft
Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\";C:\Program F
iles (x86)\Git\cmd;C:\Android\android-sdk\platform-tools
C:\Users\xxxx>adb
'adb' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\xxxx>cd\
C:\>cd Android\android-sdk\platform-tools
C:\Android\android-sdk\platform-tools>adb
Android Debug Bridge version 1.0.29
-d - directs command to the only connected USB device
Arie- said:
I don't consider myself really a noob, but this time I just cannot stand myself. I've been working on it for at least a few hours and used google extensively but I cannot find what I'm doing wrong. The screenshot illustrates it. What I've tried:
Installed android SDK in "program files (x86)" and in "c:" root
Tried various paths, with and without quotation marks
Tried paths with and without trailing backslashes
Tried paths with forward slashes
I'm probably missing something totally obvious but I just cannot seem to find the problem. I'm on windows 7 home premium 64bit.
Edit: XDA trashes the screenshot, so a link to the file my dropbox and a code dump added.
Code:
C:\Users\xxxx>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft
Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\";C:\Program F
iles (x86)\Git\cmd;C:\Android\android-sdk\platform-tools
C:\Users\xxxx>adb
'adb' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\xxxx>cd\
C:\>cd Android\android-sdk\platform-tools
C:\Android\android-sdk\platform-tools>adb
Android Debug Bridge version 1.0.29
-d - directs command to the only connected USB device
Click to expand...
Click to collapse
Take the 3 adb files from the android sdk platform tools folder and drop them in your windows directory. Then you will have adb from anywhere.
I consider that more to be a work around than an actual solution, there goes my 'clean' windows installation, again moving files around to get everything working. Bummer. I'll work with that solution for now though.
just copy the adb.exe to your username folder and type adb in cmd it will work....
I found the issue, after the Quicktime declaration there was a quotation mark floating around. Five hours of my life gone...

[Q] Problem with SDK Manager - nothing works...

(Windows 7 64-bit Home Premium)
So I've been playing around with LibGDX, and it's been really nice...so I go to export my app to android for the first time just to make sure everything's running smoothly so far...and I get an error at compile time:
Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
So I Googled, and every solution to the problem I can find involves using the Android SDK Manager, or copying some files from one directory to another that I don't have in the first place. So I decide to go the SDK Manager route, except my SDK manager shows a command-line box for a second (no console output), then crashes.
So I Googled this, and I get nothing but people telling me to both mess with Android.bat and make sure I have the right environment variables set. So here I am, about an hour later, and I've got all my environment variables set that I could possibly need: JAVA_HOME points to my java sdk folder
Path points to both my JRE and my JDK binary folder, as well as C:\Windows\System32
ANDROID_SDK_HOME points to my Android SDK folder
ANDROID_SWT points to my android folder's tools\lib\x86-64 folder, which clearly has the swt.jar, but whenever I try running android.bat I still get:
'xcopy' is not recognized as an internal or external command, operable program or batch file (which should have been fixed when I added system32 to the path variable)
ERROR: SWT folder <my swt path> does not exist (even though it does)
Please set ANDROID_SWT to point to the folder containing swt.jar for your platform (it does!)
edit: just completely uninstalled then redownloaded the sdk, same errors... :crying:

[Q] Apktool problem

I want to decompile some system apps and I can't even get apktool to work. I installed java jre and jdk both and I get the following error in cmd:
Java is not recognized as an internal or external command
So I set my environmental system variables for Java on my windows xp computer as shown below:
View attachment 2825945
But I still get the same error as before! I need someone to please help me figure this out before I get even more frustrated!
Make sure you have installed apktool correctly
Windows:
Download The Following From Here
apktool1.5.2.tar.bz2
apktool-install-windows-r05-ibot.tar.bz2
Unzip both files with winrar and put the contents (there should be 3 files) in C:\Windows
if you have java jdk installed you should be able to type apktool and hit enter at the command prompt and if installed it will give you all the options for apkool
Linux:
Download apktool-install-linux-* file
Download apktool-* file
Unpack both to /usr/local/bin directory (you must have root permissions)
Mac OS X:
Download apktool-install-macos-* file
Download apktool-* file
Unpack both to /usr/local/bin directory (you must have root permissions)
did everything still not working
I Followed this guide here which is very similiar: http://androidforums.com/esteem-all-things-root/520917-guide-how-properly-decompile-recompile-apks-apktool.html
I stopped at installing framework because CMD would not let me be able to do so!
Any other advice?
I really need to get this working!
Thanks for your help!
JT1510365 said:
I Followed this guide here which is very similiar: http://androidforums.com/esteem-all-things-root/520917-guide-how-properly-decompile-recompile-apks-apktool.html
I stopped at installing framework because CMD would not let me be able to do so!
Any other advice?
I really need to get this working!
Thanks for your help!
Click to expand...
Click to collapse
what version of apktool are you using? maybe the apktool doesn't support it.. download de jar and the appt http://forum.xda-developers.com/showthread.php?t=1755243 , open the cmd window holding shift+ right button where the apktool is placed

How to use Autosign with Linux ?

Hello,
I`m trying to edit the WhatsApp app in my android phone using Autosign ( a windows executable).
I followed all the steps until i executed the sign.bat (with Wine) and i cant keep on.
The problem is that it doesn´t recognize the other files that are needed to create the new apk.
Here you can see what appeared in the screen.
Auto-Sign Created by Dave Da illest 1 Edited to be easier to use with APK files by mixpix405 Make sure the APK you want signed is the only APK inside this folder Pulse cualquier tecla para continuar... .apk is now being signed. The signed version be named your_app_signed.apk Can't recognize 'java -jar signapk.jar testkey.x509.pem testkey.pk8 *.apk your_app_signed.apk' as an internal or external command, or batch script.
anyone knows how i can make it work ?
Just curious, why dont you use native linux tools for dis/assembling/signing etc. APKs?

Categories

Resources