[Q] Adding files to apk to install - Android Q&A, Help & Troubleshooting

Ok, I have read and read and am still stumped. Let me explain. I have a game decompiled and want to add a file to it that will copy itself to a certain location upon install. Here it is--
My goal is to take a copy of my profile.sav and insert it into the decompiled apk, possibly in the res/raw directory. When I install the .apk, I want the profile.sav to be moved to the /data/data/com.myapp.here/app_Documents/ directory. I am learning here and this is solely for the purpose of making my apps custom for me. To be able to install the app and have my settings already in place, negating the need for a backup/restore would be ideal for me. Besides, it just seems a really interesting thing to learn. Thank you in advance for all you help folks!
OH, also I read this post http://forum.xda-developers.com/showthread.php?t=601629 But, The last post by Gene Pool is provided with code. Problem is, I have no idea where to insert this code, or if it is even useful for what I am trying to do. Thanks Again!

I guess this wont be as simple a task as I had hoped.
Sent from my SAMSUNG-SGH-I727 using xda premium

Related

[Q] Signing Help ..

Hey all, Well i know we could not wait for a Honeycomb theme, i know i cannot, but heres my conundrum.
I have made a honeycomb keyboard, but cannot get it to install for the life of me, ive used the testkeys, shared, platform, etc (all using Signapktic from Stericson. Does anyone have any clue as to why it will not install?
A few questions that i know you might ask, answered ...
No, there is no other keyboard, other than swype, and samsung keypad..
I made it off of the GB keyboard...
Yes, I have made many of themes, many of changes to Frameworks, and have had sucess installing, and running my custom roms....
My question basically is this, IF POSSIBLE, CAN ANYONE SIGN THE FILES I HAVE TO MAKE THIS WORK? PM ME AND I SHALL SEND THE FILES. CREDIT WILL BE GIVIN, I AM ON THE OTHER HAND GOING TO NEED SOME SORT OF PROOF YOU KNOW WHAT YOUR DOING, I WORKED REAL HARD ON THIS, SO FOR RIGHT NOW ITS PRIVATE, HENSE THE PM.
THANKS AGAIN IN ADVANCE. REMEMBER .. LETS GET THIS HONEYTCOMB GOING
I know that most of the keyboards dont work simply by installing but rather need to be pushed to the data\app or data\app_s folder depending on which rom you are running. You can accomplish this using adb or using a file explorer like RootExplorer.
Thanks
Thank you man, this helps a whole lot. Now do i need to re-sign each apk inside the rom folder? or can i just re-sign the .zip?
georgegreco86 said:
Thank you man, this helps a whole lot. Now do i need to re-sign each apk inside the rom folder? or can i just re-sign the .zip?
Click to expand...
Click to collapse
I'm not sure what .zip you're refering to other than a CWM recovery flashable .zip for you keyboard. If this is what you mean, then use the same signiture (key) you'd find in any of the flashable .zips on the forums. In other words, just copy over the META-INF folder from some other .zip to yours. Of course, you'll want to make sure the update-script in this folder is pointing at the proper directories for installation.
For your apk, you should only need to sign it if you changed the AndroidManifest.xml. Otherwise, just keep the META-INF folder from them original apk.

[Solved][Q] .apk file questions

Hi everyone! I'm still relatively new to all these customizations that can be made on these phones, and I am curious about all these .apk files I keep seeing around. Everyone time one is posted, it says to push it to your phone to replace whatever file is there... The thing is, every time I read about it I find a new way of doing it. Some say to use root explorer, some say SGS tools app, some say to use easy installer, and I think I've even read to use ADB? I just was wondering what's the best method? Easiest method? Can you screw your phone up by replacing these files? I keep reading things like if you want to switch a camera in your ROM to a different version, just install the .apk! Or, if you want to use live wallpapers in a ROM that doesn't come with it, here is the .apk for that!
Any help is much appreciated!
Thanks guys!
tarastaryo said:
Hi everyone! I'm still relatively new to all these customizations that can be made on these phones, and I am curious about all these .apk files I keep seeing around. Everyone time one is posted, it says to push it to your phone to replace whatever file is there... The thing is, every time I read about it I find a new way of doing it. Some say to use root explorer, some say SGS tools app, some say to use easy installer, and I think I've even read to use ADB? I just was wondering what's the best method? Easiest method? Can you screw your phone up by replacing these files? I keep reading things like if you want to switch a camera in your ROM to a different version, just install the .apk! Or, if you want to use live wallpapers in a ROM that doesn't come with it, here is the .apk for that!
Any help is much appreciated!
Thanks guys!
Click to expand...
Click to collapse
You CAN screw your phone up if you do it to the wrong APK (like /system/framework/framework-res.apk, if you install a bad one, your phone won't boot, but there is an easy fix, nandroid!).
Basically all the methods do the same thing. In Android "Installing" an app is as easy as moving it to the correct location. All of these methods do just that.
The easiest way IS to probably use Root Explorer because you can rename the old one just in case, and it will handle the system read/write mounting for you. Plus GUIs are always easier.
So here's how it works: user apps go in /data/app, and system apps go in/system/app. User apps can't really mess anything up, but be careful with System ones. Live wallpapers, things of that nature usually don't hurt. Camera is ok to mess around with, too.
Edit: my ramblings are probably confusing, don't hesitate to ask me to clear something up
usually most apk files can be installed easily by transferring the file to the root of your internal sd card then go to MY FILES locate the apk file and click on it and it will ask you to install. Thats it. You can also root explorer and just place it in the system/app folder then reboot. I install all of my apks through the first way I mentioned. On my wife's Mytouch4g there is no my files so use Astro file manager. Come to think of it any file manager from the market will do. Good luck...
tarastaryo said:
Hi everyone! I'm still relatively new to all these customizations that can be made on these phones, and I am curious about all these .apk files I keep seeing around. Everyone time one is posted, it says to push it to your phone to replace whatever file is there... The thing is, every time I read about it I find a new way of doing it. Some say to use root explorer, some say SGS tools app, some say to use easy installer, and I think I've even read to use ADB? I just was wondering what's the best method? Easiest method? Can you screw your phone up by replacing these files? I keep reading things like if you want to switch a camera in your ROM to a different version, just install the .apk! Or, if you want to use live wallpapers in a ROM that doesn't come with it, here is the .apk for that!
Any help is much appreciated!
Thanks guys!
Click to expand...
Click to collapse
An apk is a specialized application file used by android (uses the same file headers as .zip files).
You are correct that there are various methods to push or move apk's to appropriate directories with in the phone. now as to which is easier or best, all methods work about the same, though there are minute differences.
If you want to move apk's into a certain directory while using a phone i find it easiest to use a file manager like root explorer that has root permissions to move apks around. keep in mind that when moving system files most often you will have to reboot for the changes to take effect with out bugs.
If instead you want to use a computer personally i find ADB to be the easiest. After installing the android sdk you will have to navigate into the android sdk directory then to the platform-tools directory within the android sdk folder. then in command prompt type " adb push <directory of file on your computer> /<directory of where you want it on your phone> hit enter and all is gravy. keep in mind that pushing/moving files to your phone using adb works the best when in recovery mode.
as to which of these operations is the best is a personal decision personally i like to use adb to move around system files and root explorer for applications.
hope this helps
Thanks guys!! Ok, so just to be sure. I'm currently running the Malice rom, and somewhere in the threads is the LiveWallpaperPicker.apk
So all I have to do is download this, place it on the root of my internal SD card, go into file manager and find it, click on it, and it will ask me to install it? It's really that easy??
Or, should I download root explorer and copy and paste it to a specific place?
tarastaryo said:
Thanks guys!! Ok, so just to be sure. I'm currently running the Malice rom, and somewhere in the threads is the LiveWallpaperPicker.apk
So all I have to do is download this, place it on the root of my internal SD card, go into file manager and find it, click on it, and it will ask me to install it? It's really that easy??
Or, should I download root explorer and copy and paste it to a specific place?
Click to expand...
Click to collapse
For that file you will need to place it in /system/app (it can't be installed normally because it's a system app). So you need something like Root Explorer
I think EStrongs File explorer is a decent free alternative, but when I tried it a couple months ago I had no luck with it so I just bought Root Explorer (good investment)
The guide in my signature touches on this, but BT has you covered. I am also a huge advocate of Root Explorer.
Just take the .apk, move it to system/apps and I reboot, but it may not be necessary... no need to click on it and select install, as BT referenced.
Thanks so much everyone! Just purchased root explorer and will try this out.
IT WORKED IT WORKED IT WORKED!!!!!!!!!!!!!!!!!!!!
After I rebooted, none of my widgets could load, but I have live wallpapers again! I love learning new stuff! Thanks sooooooooooooooooo much! You guys are the BEST!!!
Odd about the widgets. Were you able to just remove them and re-add them back?
Yep, just deleted them off my home screen and added them back again. All of them had errors saying widget could not load

[Q] APK Creation

Well as many of you know we're over most of the hurdles we needed to jump with the CM7 build for Nook tablet.
Updates for the internal version are simple via CWM, the SD version is not so simple of course.
I'm assuming that it should be possible to built an APK that gains superuser permissions then copies the new files to the system. Can anybody confirm this is possible please?
We need to know that we can tell our SD user that they can update their version just as easy as the internal user
Thanks in advance for your help again everyone!
Well presumably this is how ROM Manager and Metamorph both do their thing, just in a slightly more round about way (as they don't come with the files they need to copy). I'm almost 100% sure this is possible, but I've never tried it personally.
EDIT: Looks like this is how you'd do it: http://developer.android.com/reference/java/io/File.html. Specifically the renameTo() method.
CelticWebSolutions said:
Well as many of you know we're over most of the hurdles we needed to jump with the CM7 build for Nook tablet.
Updates for the internal version are simple via CWM, the SD version is not so simple of course.
I'm assuming that it should be possible to built an APK that gains superuser permissions then copies the new files to the system. Can anybody confirm this is possible please?
We need to know that we can tell our SD user that they can update their version just as easy as the internal user
Thanks in advance for your help again everyone!
Click to expand...
Click to collapse
Well there are about a dozen ways to do this. First of one of the hardest things is comming up with the commands/script. I can defiantly do this. If you want an apk, there are a few guys whom could port my script to an apk. I'm going to make a script here that will format, and create partitions and extract directly from the nook, no need to go through the fancy formatting and such, just go into terminal and run the script. Ill post a prototype for you to have the testers test!
Do you think something like BacksideUpdater inside custom ROM for LG Optimus V?
made by JerryScript
JerryScript i very nice guy, I bet if you ask him, he will let you play with his code
if is it what you looking for
Yes, this is possible. I wrote an app that flashes the recovery partition for my older Froyo phone in the very rudimentary Basic4Android. Copying files under root privileges was part of this process. Fairly easy if you find the right coding examples in whatever your development platform of choice.
xdajunkman said:
Yes, this is possible. I wrote an app that flashes the recovery partition for my older Froyo phone in the very rudimentary Basic4Android. Copying files under root privileges was part of this process. Fairly easy if you find the right coding examples in whatever your development platform of choice.
Click to expand...
Click to collapse
So one of the problems is its not really copying. Its more of an extraction from one place to another. We are required to use dd, and fdisk(for formatting).
GREAT! I was worried updates would be to complicated for people
Sent from my Nook Tablet using xda premium
... and I was worried that I might have to wipe my NT clean again to get the updates. After a week with this wonderful upgrade, I've got a LOT of customization I don't want to lose...
Whoops, wrong button with the thanks. Anyway, it occurs to me you could just have people run a script from a terminal emulator. That would probably be the simplest way to do it. Make an Update folder on the SD card, add it to the PATH by default, and users could just copy over the update files and run the script. Just a thought.
Sycobob said:
Whoops, wrong button with the thanks. Anyway, it occurs to me you could just have people run a script from a terminal emulator. That would probably be the simplest way to do it. Make an Update folder on the SD card, add it to the PATH by default, and users could just copy over the update files and run the script. Just a thought.
Click to expand...
Click to collapse
Has to be simple, something like copy an update.zip onto the SD card then run the apk which will automatically run the update in the zip But my knowledge of such things is limited so I need help there
Same process. With the above method, the user would only have to copy over the file, open a terminal, and type 'update'. With the apk idea you just have to add a little more time for someone to actually write the app (not that it would take too long).
Sycobob said:
Same process. With the above method, the user would only have to copy over the file, open a terminal, and type 'update'. With the apk idea you just have to add a little more time for someone to actually write the app (not that it would take too long).
Click to expand...
Click to collapse
Hmm.... that sounds good.
Anybody know how to actually implement it ?
Dammit, idk why I keep hitting the thanks button thinking it's reply >.>
Anyway, it's just a matter of setting the PATH variable to include /sdcard/Update/ or something similar. To make an actual update, make a folder called Update, fill it with all the files that need to be copied over (probably in a directory structure), and write a script that actually copies everything over. You'll need to make sure sh is in /system/bin (I think it is by default).
You could zip the the files as well, using gunzip (busybox?) to extract them before copying them, then deleting them when you're done, just to keep it cleaner for the user.
The only downside to all this is that I don't know how you would flash a kernel.
Sycobob said:
Dammit, idk why I keep hitting the thanks button thinking it's reply >.>
Click to expand...
Click to collapse
That makes two of us!
Sycobob said:
Anyway, it's just a matter of setting the PATH variable to include /sdcard/Update/ or something similar. To make an actual update, make a folder called Update, fill it with all the files that need to be copied over (probably in a directory structure), and write a script that actually copies everything over. You'll need to make sure sh is in /system/bin (I think it is by default).
You could zip the the files as well, using gunzip (busybox?) to extract them before copying them, then deleting them when you're done, just to keep it cleaner for the user.The only downside to all this is that I don't know how you would flash a kernel.
Click to expand...
Click to collapse
I'm guessing you'd just flash it as usual, surely that one is the easiest? Copying stuff to boot partition would hopefully be just as simple, I was mainly worried about updating system files. I could do with building one for the current update to test the theory!

[Q] ICS Settings.apk? Is this possible?

http://forum.xda-developers.com/showthread.php?p=24317850#post24317850
I came across this and I thought it would be cool to do. I have been trying to work on this but but I am getting an error when trying to recompile the program. I am putting it here to see if anyone else can have success with it? It does look cool and I think it would be a great add in for some roms we have here!
1. I have decompiled the rom
2. I did the settings changes that were directed
I am a noob to all of this stuff. This is my first decompile apk project and I do not know what I am doing lol.
I see that there are files to download but the guide does not tell us where to place that.
3. when trying to recompile on step 7/8 I get errors that it does not there is no resources and then it fails.
My question is do you think this is possible with our phone? Does anyone want to give it a try. I actually have a Milestone x2 running 2.3.6. But I wanted to see if this worked for Droid x2 as well. Please let me know I would greatly appreciate it!
Good lord now I have something to do in my spare time! I'm gonna give this a shot and report my results. Might be a few days though, semester is ending.
I'm not entirely sure why you are getting errors when recompiling. It would be nice if I could actually mess around on your pc to figure it out but that's obviously not an option. Lol
Sent from my MB870 using xda premium
lol, I think this might be really neat! Let me know what you come up with. I am very new to this whole thing so it might be something I am doing or something that is written that I might be missing or skipping.
I didn't actually click the link you provided (to tired and lazy atm ), but I'm assuming your using either APK Manager or APK Multi-Tool (I highly recommend Multi-Tool as it's the new APK Manager and the dev keeps it up to date)
Usually if your getting an error like that while trying to compile it's due to missing or out of date APKTool files. Google "APKTool" it should be your first link.
Make sure you have these files up to date and stored correctly (Windows directory)
Also make sure APK Multi-Tool is up to date (version 1.0.2)
Hope this helps.

Looking for a proper order to flash

ok so im loving the svn and superlte and all that, can someone please give me some direction as an order to flash all the different mods and such? i understand different orders for different purposes im just looking to get mine as fast as possible and able to tweak the hell out of everything and . Also a follow up question when checking out and after exporting i add my apps and such what do i gotta do besides zipping up the file to make it flash right? has always i appreciate any feed back anyone can give me
BigTexastrev said:
ok so im loving the svn and superlte and all that, can someone please give me some direction as an order to flash all the different mods and such? i understand different orders for different purposes im just looking to get mine as fast as possible and able to tweak the hell out of everything and . Also a follow up question when checking out and after exporting i add my apps and such what do i gotta do besides zipping up the file to make it flash right? has always i appreciate any feed back anyone can give me
Click to expand...
Click to collapse
Not sure I'm quite up to date on the latest ROM slang lingo, but I'll do my best to provide some insight from a developers point of view.
In regards to creating a ROM .zip, which I think is what is referred to as, "checking out and after exporting I add my apps and such what do i gotta do besides zipping up the file to make it flash right?", the process is fairly generic. The ROM .zip (update.zip) file will be processed and loaded in the custom recovery.
The directions are generally all located in the updater-script file under META-INF/*. If the only action being done is adding apps to /system/app on a ROM .zip which already contains apps in /system/app, nothing should need to be changed in the updater-script file.
If apps are being added to /data/app, but nothing in the ROM currently installs to /data, might need to a copy_recursive to updater-script to make sure the /data directory from the ROM .zip is installed properly.
If there are other questions, the more detailed the links and question, the better we can answer! Hope some of the technical details help resolve the question!

Categories

Resources