[Q] recompile apk? - Android Software Development

I accidently deleted the apk file from the bin directory of one of my projects and now everytime i try to compile/run it I get an error message saying that the apk can't be located. How do I fix this?

Try to clean your project. I don't know Eclipse, but there should be a "clean" command in menu->project, menu->build, menu->run or something like that.

Related

[Q] Modifying Stock Keyboard

Hey all,
I was wondering whats the process to modify the stock multi-touch keyboard for the Droid 2? I was able to do it with the multi-touch keyboard that Punk.Kaos ported to the Eris, using some Windows batch files for extracting the apk source, compiling, signing, etc. I just can't remember for the life of me what that little program was called. Any ideas?
Thanks!
it would be nice since the space bar is soooo small i keep pressing . instead of space 70% of the times
Alright, I was able to get the program I was thinking of, it is called APK Manager. But the keyboard is a odex file... Which I don't know how to extract the XML files from... Yet.
I'd de-odex before you try to extract. It will be a lot easier. There's the method I used here.
What exactly is de-odex'ing? How will it affect my phone?
Deodexing just means that all of the stray .odex files will be put back into the correct .apk files this is done mostly for theme purposes in order to edit the services.jar file which has to be de-odexed before it can be edited. It won't corrupt anything if you do it right nothing should change on the outside the phone devs leave the .odex files out for loading reasons but nothing significant should change but you might experience a slightly slower boot up process but like I said nothing significant. Most ROM's now are de-odexed though.
So I deodexed my phone so I could work on the LatinIME.apk package. Using the APK-Manager for Linux, I was able to (0) pull the APK from my phone. Then I (9) decompiled the APK, edited the XML files as I wanted.
Now, from here I'm not entirely sure which direction to take. I tried running (13) Compile APK / Sign APK / Install APK, but I got an error saying something on how the signatures didn't match up. Then I tried running (3) ZIP APK (5) Zipalign APK then (8) ADB push, but now I don't even have the keyboard on my phone anymore.
How can I go about doing the correct way to compile my modified code and install it on my phone?
Here are the options I can do, if you're not familiar with APK Manager:
Code:
------------------Simple Tasks Such As Image Editing----------------------
0 Adb pull
1 Extract apk
2 Optimize images inside (Only if "Extract Apk" was selected)
3 Zip apk
4 Sign apk (Dont do this if its a system apk)
5 Zipalign apk (Do once apk is created/signed)
6 Install apk (Dont do this if system apk, do adb push)
7 Zip / Sign / Install apk (All in one step)
8 Adb push (Only for system apk)
-----------------Advanced Tasks Such As Code Editing-----------------------
9 Decompile apk
10 Compile apk
11 Sign apk
12 Install apk
13 Compile apk / Sign apk / Install apk (All in one step)
---------------------------------------------------------------------------
14 Batch Optimize Apk (inside place-apk-here-to-batch-optimize only)
15 Sign an apk (inside place-apk-here-for-signing folder only)
16 Batch optimize ogg files (inside place-ogg-here only)
17 Quit
****************************************************************************
Anyone? I would love to get my stock keyboard back!
Sent from my DROID2 using XDA App

apktool compiling problem

Hi,
I use apktool and have a problem.
I sucessful decompile apk and get direcrory with app name.
When compile this directory (without change) I get apk file.
But apk file cannot install on phone!
What I do wrong?
I just decompile and compile without change and apk cannot install...
Help..
atlantisu21 said:
Hi,
I use apktool and have a problem.
I sucessful decompile apk and get direcrory with app name.
When compile this directory (without change) I get apk file.
But apk file cannot install on phone!
What I do wrong?
I just decompile and compile without change and apk cannot install...
Help..
Click to expand...
Click to collapse
What apk is it?
Some .apk's just will not install. I had an apk that compiled 1MB smaller, without change. Its not a perfect system.
Name is not important, but original file size is 1,376 MB
and compiled file size now is 1,372 MB
Where is 4KB?
Well I only asked the name incase it was one I myself had issues with or someone else had.
Now I just think you're doing something suspicious by answering.like that
4KB not as bad as 1MB. But you're still losing size which will be why it won't install.
Can't help any more than that I'm afraid. Except to say I have seen the issue before and never resolved it
Sent from my HTC Desire using Tapatalk
Suspicious
I tried more apk without sucess..beacause I dont tell a name.
Actual apk is BeoGSP-6.apk and there I lost 18KB...
I dont understand this compiler!?
Is there any another compiler with more working chance?
Can I export resource to Eclipse and make apk from here?
There is also APK manager. its pretty similar as far as I can tell.
There's APK Manager or APK Multi Tool which I use and both do the job quite well. I need APK Multi to decompile ICS or newer APK's and I use APK Manager 4.9 to decompile the APK's from the oxygen ROM.
If it decompiles and recompiles without errors then the only thing you might need to do is sign the APK. It won't install if it's a non-system APK and you haven't signed it.
APK Manager 4.9 option 16 signs the APK's so I just use that and if there're no errors it will sign and install fine.
Thanx! Works with APK Manager. This is a great thing!
I signed apk and now work

[Q] Problem with recompiling an apk

May be this not a right place to ask, but I have this problem with recompiling an apk with apkmanager.
I'm trying to mod settings.apk and had done few modding in strings.xml. Since I have edited an xml I delete the resources.arsc file from the keep folder and also sign it after recombiling. But when I install the apk in my phone it never opens and force closes.
I've tried again by not deleting that file but that time no modifications where shown, And the next time, I didn't sign it and tried again to install the unsigned apk. But that too fails.
Anyone know why this happn?
Before modifying the APKManager, make sure the framework-res.apk and twframework.apk been set, and don't forget to delete the file resource.arsc and the file you have modified, then enter at apkmanager windows, don't forget to rename Unsigned to system file that you modified

[GUIDE]Deodex An Application

Hey Guys,
This is a small tutorial for those who want to Deodex a Single Application manually.
Deodex And Odex:
The APKs or JARs of Android contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.It will make your faster theoretically even though it would be too small to notice.When deodexing the .odex file is changed to classes.dex file. Deodexing also allows us to theme and install mods.Many of the Stock Roms and CyanogenMod 7 roms are now odexed and to theme them or to add mods we need to have it deodexed. So lets learn how!!
Deodexing:
Preparation:
Hope you have Java Development Kit installed on your computer to run the scripts.Get it from: here.Select you OS from the list and download the suitable package.(We would need the full thing and not the Demo versions.)
Download the Attached .zip File
Extract its Contents to a Folder.(Extracting to a New Folder in the Desktop is Preferred for Ease)
We will name this Folder with the Extracted Contents as Deodex(or any name that you like)
Procedure And Explanations:
First of all copy the Application file that you need to Deodex.A Android Application file is the .apk file found in the system/app directory.Copy the .apk file and the .odex file of the application that you want to Deodex and paste in the Deodex folder(Folder to which the attachment's contents was extracted)
Now go to your system/framework directory and you can see a lot of .jar and .odex files in this folder and copy all its contents to the folder to which the attachment's contents was extracted.
Before doing anything more backup your rom and the application file(If anything goes wrong you can use it then)
To Deodex a application you need to specify its "BOOTCLASSPATH" files. BOOTCLASSPATH are files that contain the classes for an application or in simple language BOOTCLASSPATH files are those files that are required by a android application to run properly. They are actually those files that we have copied from the system/framework directory to our Deodex folder. There are mainly 5 BOOTCLASSPATH files for every android rom.They are: android.policy.jar , core.jar , bouncycastle.jar , ext.jar , framework.jar
All apps are dependent on these files but some apps are dependent on some other BOOTCLASSPATH files.So sometimes the problem is that we actually dont know to which of these files is a particular app dependent to.So we will have to specify all the BOOTCLASSPATH files or the .jar files in the system/framework directory.So problem solved!! Now enough with the theory class,lets proceed to the practical classes!!!!!
Open Command Prompt.
As an example we will Deodex Settings.apk
Type in this command in Command Prompt:
Code:
java -Xmx1024m -jar baksmali.jar -c :am.jar:android.policy.jar:android.test.runner.jar:bmgr.jar:bouncycastle.jar:
com.android.location.provider.jar:com.google.android.maps.jar:sonyericsson.suquashi.jar:
core.jar:corej-unit.jar:ext.jar:framework.jar:ime.jar:input.jar:java.awt.jar:javax.obex.jar:monkey.jar:pm.jar:
:services.jar:sqlite-jdbc.jar:svc.jar -x Settings.odex
Here:
-Xmx says the heap memory needed.In the above command it is given to 1024m. Sometimes deodexing may have errors due to the low heap memory.So set it to 1024m itself.
-jar baksmali.jar says the program to run baksmali.jar file.
-c says that the following files are the BOOTCLASSPATH files of the application we are deodexing.
-x says the name of the application that we are deodexing.It should end with .odex extension.
Note:
When you specify the .jar files just add all those .jar file names in the system/framework folder(only add the .jar files and not the .odex files).Ensure that you have added the .jar extension at the end of each file. Separate the .jar files with colon " : " symbol.
If you have made no spelling errors and have done everything mentioned you will get a folder named "out".
Now we have to smali the out folder into classes.dex file.
So again type in the Command Prompt:
Code:
java -Xmx1024m -jar smali.jar out -o classes.dex
Here:
-o says what the output file should me named to.Dont rename the classes.dex file into anything else.
Now you will have a file in our Deodex folder(Folder to which the attachment's contents was extracted) called "classes.dex".
Finalizing:
Now open the application's .apk file(which you were trying to deodex) with WinRar.
Move the classes.dex file that you got to this .apk file.(Just drag and drop it to the .apk file opened with WinRar.)
Now you will have a deodexed .apk file.
Note: After deodexing you will have to delete the .odex file of the particular application which you had deodexed.
I will make a guide to Odex back a Deodexed application soon!
Hope this guide helps you....
For any doubts or questions please post it here in this forum and I will try to attend to it.........
Re: Deodex A Single Application
Thanks bro..
Good tut..
sent from my phone using hands and brain...
thanks
Re: Deodex A Single Application
Good tut...
But quite long
Sent from my W8 using xda app-developers app
hey...nice tutorial and nice explanation :good:
thanks
Re: Deodex A Single Application
But helpful too...
sent from my phone using hands and brain...
Gogeta said:
Good tut...
But quite long
Sent from my W8 using xda app-developers app
Click to expand...
Click to collapse
I made it long so that everyone understands.Even those who are very new to android
i'm stucked when i try to deodex settings.odex..
any suggestions???
Hidzrie said:
i'm stucked when i try to deodex settings.odex..
any suggestions???
Click to expand...
Click to collapse
you must deodex
settings.apk + settings.odex.....
i've already follow exactly like the tutorial above but cmd just stucked...
in 'out' folder there are \com\android\settings\ folder and these files were in it and nothing more:
AccessibilitySettings$1.smali
AccessibilitySettings$2.smali
AccessibilitySettings$3.smali
AccessibilitySettings$4.smali
AccessibilitySettings$5.smali
AccessibilitySettings$6.smali
AccessibilitySettings.smali
please anyone help..
Credit/thanks: http://forum.xda-developers.com/showthread.php?t=1208320 ?
Hidzrie said:
i've already follow exactly like the tutorial above but cmd just stucked...
in 'out' folder there are \com\android\settings\ folder and these files were in it and nothing more:
AccessibilitySettings$1.smali
AccessibilitySettings$2.smali
AccessibilitySettings$3.smali
AccessibilitySettings$4.smali
AccessibilitySettings$5.smali
AccessibilitySettings$6.smali
AccessibilitySettings.smali
please anyone help..
Click to expand...
Click to collapse
follow the highlighted lines and try again and deodexing takes time according to your computer's ram.so be patient.if you still cant do it then just upload the system=>framework folder and the app you want to deodex and its odex file and Private Message me the links. I will check whats the problem.
L_S said:
Credit/thanks: http://forum.xda-developers.com/showthread.php?t=1208320 ?
Click to expand...
Click to collapse
this can be found in the android sources site but it not so easy to understand for beginners so i made it a little easier to understand and i didnt refer that guide because all is clearly written in the android sources site.
i understood why some of you are making mistakes when trying to deodex a apk or jar file.
its because you are copying exactly the same bootclasspath files that i specified in the guide.
it varies depending on your device and your rom. So I have made some changes in my guide.some lines are highlighted in red.
follow those lines.
Hidzrie said:
i'm stucked when i try to deodex settings.odex..
any suggestions???
Click to expand...
Click to collapse
Specify your device and rom that you use. Are you sure that you followed what i told itself? Try it once more as I have made some more changes in the guide to help you guys.
Still if you cant do it then just copy your framework folder and the apk and .odex file that you want to deodex and pm me. I will try to deodex it.
fotak-x said:
you must deodex
settings.apk + settings.odex.....
Click to expand...
Click to collapse
no fotak we dont need to deodex settings.apk. We only need to deodex the .odex file but we will have to keep the apk file also in the same folder.
Leon1234 said:
Specify your device and rom that you use. Are you sure that you followed what i told itself? Try it once more as I have made some more changes in the guide to help you guys.
Still if you cant do it then just copy your framework folder and the apk and .odex file that you want to deodex and pm me. I will try to deodex it.
Click to expand...
Click to collapse
I'm using samsung gt-s5830i.. Rom simplicity v4..
I've tried like many times..still wont work..
Hidzrie said:
I'm using samsung gt-s5830i.. Rom simplicity v4..
I've tried like many times..still wont work..
Click to expand...
Click to collapse
dont worry,we can figure it our!
what error are you getting in command prompt?
can you give the lines that come up in command prompt?
Leon1234 said:
dont worry,we can figure it our!
what error are you getting in command prompt?
can you give the lines that come up in command prompt?
Click to expand...
Click to collapse
There are no error appear on cmd..
After I insert a command to deodex settings.odex and press enter, it just like nothing happen...
There are no error appear on cmd..
After I insert a command to deodex settings.odex and press enter, it just like nothing happen...
Click to expand...
Click to collapse
you will have to wait for some time when deodexing depending on the ram of your device.
what is the ram of your computer?
and do you have java 7?

cannot complete decompile apk file procedure succesfully

hello i am a newbie on android development and i am just trying to decompile an apk file.i have done it all correct using apk tool and when i am trying to decompile the apk file via command prompt it doesn't dissapear the folder with the name of apk which encluding the resource files.any ideas???
Dont show log, so i could not help.
But when you compile it, selected signed or unsigned apk. For debug, unsigned apk is okay. With signed apk, searching for how to make progruard-rules, how to config it. Then everything will work.

Categories

Resources