I'm new to the forums and a novice programmer but here's my question:
There's an app I'd like to run on my device for work. Per the play store, the app requires Android 2.3.3 and I'm running 2.2.2. I'm running the most recent version of a custom ROM on an outdated device so can't update my device's build.
I'm wondering if it's possible to tweak the app's source code and repackage it to make it run on my device. I have downloaded the .apk file and tried to install it on my phone and get a parsing error. So with the help of google I have managed to get into the source code using dex2jar and jd-gui. Problem is I don't know much about how apks are written. I found something in the 'accessibilityservice' area that seems to check the android build version, but as far as I can tell that is checking for whether the device is running ICS (if build >= 14) whereas the app is said to be compatible with older builds as well.
Anyway - how complicated would it be to port an app backwards so that I could run it on my phone? You should assume that I'm already in over my head.
Thanks.
petegw42 said:
I'm new to the forums and a novice programmer but here's my question:
There's an app I'd like to run on my device for work. Per the play store, the app requires Android 2.3.3 and I'm running 2.2.2. I'm running the most recent version of a custom ROM on an outdated device so can't update my device's build.
I'm wondering if it's possible to tweak the app's source code and repackage it to make it run on my device. I have downloaded the .apk file and tried to install it on my phone and get a parsing error. So with the help of google I have managed to get into the source code using dex2jar and jd-gui. Problem is I don't know much about how apks are written. I found something in the 'accessibilityservice' area that seems to check the android build version, but as far as I can tell that is checking for whether the device is running ICS (if build >= 14) whereas the app is said to be compatible with older builds as well.
Anyway - how complicated would it be to port an app backwards so that I could run it on my phone? You should assume that I'm already in over my head.
Thanks.
Click to expand...
Click to collapse
A LOT of things changed from pre-2.3 to 2.3 in Android, code-wise. It was a huge upgrade, and a lot of unsupported things were implemented.
It's set to run on 2.3.3 simply because it uses functions that only exist in 2.3.3 and higher.
So to backport it you'd need to get the source code, check what functions require 2.3.3 or higher, edit them to use other functions/write the code yourself. You can't just simply remove the code that checks what version of Android you're running. That won't do a damn thing.
The last part is the near impossible one, because you'd most likely have to write code that goes deep into the Android framework.
If i were you, i'd simply look for another app that can do what you need and doesn't require 2.3.3 or higher. Though there aren't many out there. Most people base their app on 2.3.3 because like 95% or higher use that version (or a higher one).
If you were to dive into this, you'd need extensive knowledge of Android, Java & backporting.
Though i'm not able to help with that, at least the backporting part.
Moonbloom said:
A LOT of things changed from pre-2.3 to 2.3 in Android, code-wise. It was a huge upgrade, and a lot of unsupported things were implemented.
It's set to run on 2.3.3 simply because it uses functions that only exist in 2.3.3 and higher.
So to backport it you'd need to get the source code, check what functions require 2.3.3 or higher, edit them to use other functions/write the code yourself. You can't just simply remove the code that checks what version of Android you're running. That won't do a damn thing.
The last part is the near impossible one, because you'd most likely have to write code that goes deep into the Android framework.
If i were you, i'd simply look for another app that can do what you need and doesn't require 2.3.3 or higher. Though there aren't many out there. Most people base their app on 2.3.3 because like 95% or higher use that version (or a higher one).
If you were to dive into this, you'd need extensive knowledge of Android, Java & backporting.
Though i'm not able to help with that, at least the backporting part.
Click to expand...
Click to collapse
Thanks for the very helpful information. I will definitely not be attempting this.
Most likely will be getting a newer phone in a few months when I'm due for an upgrade so it'll be a moot point. Until then, I'll get by.
Related
Gents,
I need your help about "kernel", as I know when installing Android I need the folder named Android and the data.img.
But the kernel what is that?
Thanks for reading and more for helping.
The kernel is the core of the Android OS. Windows too runs on a kernel. Every build already includes one, and usually the most up-to-date or stable version, so you shouldn't have to worry about it, unless you want to update your kernel some time in the future.
I've been running Android for several months now and I've not updated the kernel once.
Still there is somthing to say
First I want to thank you for giving me some of your time.
The answer is clear, but why there is update always (now is 8.6)?
and what the kernel is including, is it the same of Android folder?
I hope I will find some more time.
Check out here for a bunch of explanations of terms that are commonly used around here
http://forum.xda-developers.com/showthread.php?t=852660&highlight=glossary
The reason that the kernels are updated alot is that the people who build the kernels find flaws in them through testing them, and through the feedback they recieve here on XDA.
Then they work to try and find ways to fix those flaws. Sometimes in fixing one flaw, a new one emerges. Generally it is a good idea to use the latest version of whatever kernel came with the build.
I have been active in the Linux community for years. Yet, I am completely lost with Android. Let me offer some assumptions. Some will be true and some are probably false. Would some kind person please point out my errors?
Versions of the android o/s include a kernel and the base applications
Applications get their hooks from the kernel which is why the ICS browser probably won't run on Froyo.
Applications are generally hardware agnostic
Therefore, it is the kernel that determines the version of android.
Therefore, if I successfully compile a new kernel to the version that ICS is using, I can migrate the ICS base apps and I am running ICS.
No need for diplomacy. Moreover, this is an intellectual exercise - my phone runs just fine with Froyo
Take a look:
http://www.slideshare.net/gxben/as-2013-jelly-bean-device-porting-walkthrough
nagato.fm said:
Take a look:
http://www.slideshare.net/gxben/as-2013-jelly-bean-device-porting-walkthrough
Click to expand...
Click to collapse
Thanks. Good stuff. I recall Zores from Mplayer which I still use.
Hello, I'm trying to build an app called Commotion Wireless from its source code - I didn't make this app myself, so it should be a simple case of following the instructions in the README, importing into Eclipse and exporting as a .apk. However, upon attempting to build, there are 3 errors: two saying "isIBSS cannot be resolved or is not a field" and the third with "frequency cannot be resolved or is not a field". The offending pieces of code are here:
github.com/opentechinstitute/commotion-android/blob/cm/src/net/commotionwireless/profiles/Profile.java - lines 201 and 202
github.com/opentechinstitute/commotion-android/blob/cm/src/net/commotionwireless/meshtether/NetworkStateChangeReceiver.java - line 92
Now as many of you know, stock versions of android don't seem to support ad-hoc networks, this is functionality that other custom firmware such as Cyanogenmod adds. As far as I can tell, this app is intended for cyanogenmod (as the devs state in URL1 below). Therefore I think that the definitions of "isIBSS" and "frequency" are not in the stock versions of andriod (URL2 is a patch somebody wrote that adds them), and the root of my problem is that I'm trying to build the app based upon the stock version of android that doesn't understand what "isIBSS" and "frequency" mean. I have never tried to build an android app before so have little experience, but my first instinct was that I needed to install a custom version of the android SDK for Cyanogenmod that would have the needed definitions in - however as far as I can tell, no such thing exists.
Does anyone here have any idea how I may resolve this issue? Your help is much appreciated
URL1: commotionwireless.net/developer/resources/commotion-android/
URL2: thinktube.com/files/android-ibss/patches/frameworks-base-0001-Wifi-Enable-Ad-Hoc-IBSS-network-configuration.patch
Hello all,
Starting of Android Lollipop (5.x), Google presented an official API for accessing the SD-card (among other things) called "DocumentFile" or SAF.
It's quite a restricted API compared to File, but that's the official way to use files.
Yet, up until now, because the File API was used for all apps, rom developers always chose to allow File API to be used and work even for SD-cards.
While this is nice for power users and maybe people who don't care about it, this is bad for me as a developer, because I need to have those restrictions (of forcing me to use the DocumentFile instead of File) as they exist on real stock roms.
It's not just me, but I've found a lot of apps out there that don't use the official API at all. Even "Total Commander", an app I'm still using, can't fully use it, as when I ask to send multiple files to it using DocumentFile, it fails.
Sadly, other than the real stock rom of Samsung (and not those based on them, or of course those like CM) , I can't find any rom that when using File API - it won't let me modify the sd-card files.
Now that Android 6 is coming, I think it might get even weirder, as there will be a new permission mechanism for storage.
My question:
Is there any rom or anything I can easily do (i'm not a rom developer) to have near-stock experience in terms of accessing the SD-card?
I hope I'm clear on this. English isn't my main language, so I've tried to find alternative ways to express what I want to talk about.
Maybe one of the GPE roms around here. But those are only for the GT-I9505 model.
Today I wanted to talk about porting current versions of TouchWiz from one device to another. This will be focused primarily on the Sprint network capability since that is my current carrier. But these same basic steps will apply for all porting of TouchWiz.
I know several people have ported roms but I first want to point out one important fact. There is ABSOLUTELY no "guide" that can help you port TouchWiz roms successfully. Period. Any "guide" thread that you may find is completely useless and is isn't even close to touching on the key components of today's porting methods. So don't waste your time reading guides because they are very outdated and irrelevant today.
First things first... When deciding to port a Samsung Rom you need to understand that there are going to be different chipsets for the different device models used in other parts of the world. With this in mind you need to choose software that was originally designed for the same similar cpu whether it be Exynos or Qualcomm. This makes a huge difference when it comes to cpu configs that will best support your device's cpu. If you try to port an Exynos rom to work on a Qualcomm device then expect to have to do a lot more work in framework, etc.
GSM vs CDMA is another very important part of the porting process. When possible, ALWAYS choose software that supports your specific carrier and service type/technology!!! If you are on a GSM network then choose a GSM rom and same for CDMA. However CDMA technology here in the US is a bit different from other countries in regards to how it is setup in the software. Each CDMA carrier will have it's own unique code inside system files. Simply replacing csc and other files will do NOTHING to fix this, leaving you with either no data services or improper generic data services. The only way to do this right is to either start with software for your specific carrier or manually modify these values in multiple files throughout framework and system using the correct values from software specific for your carrier. No exceptions.
The other thing. You ideally want to port the same Android version that is currently available for your specific device because the original kernel and libraries, etc need to support the version of Android in which you want to port. When porting you will be using most of your original software's bin files, kernel, etc... so these files need to be compatible with the version of Android you want to port. Very important!
I will not go into great details with smali modifications, etc because that is a whole different animal. This thread is a general breakdown of what is involved in the whole process. Porting a ROM such as the Note 7 software is no simple task, especially with so many unknown obstacles that must be discovered then remedied. You will need the right tools for the job before you even take on such a task. I'm talking about ApkTool, smali/baksmali, mad genius mentality, etc. Without the proper tools forget about it.
The main things that must be done for the rom to even boot, reside internally inside a few framework jar files. There will also be incompatible system files which must be removed and/or replaced with compatible versions that support your specific device/model. You also may need to make the rom support 32bit such is the case with the Note 4, since it is only 32 bit compatible. There can be no traces of 64bit libraries either inside the system apps or the library folder or else you will have issues. 32 bit devices cannot process 64 bit libraries, whether external or imbedded inside system apps. The one exception to this rule is when an app is multi-arch compatible which means the app can be installed on either 32 or 64 bit devices. In this case the 64 bit libs can remain although they will not be used since the 32 bit libs will be detected by the os. Thankfully 64 bit TouchWiz contains 99.9% of the necessary 32 bit libraries! So use them instead if your device is only compatible with 32 bit architecture.
There are several key Android/Samsung services that are not going to be compatible with other Samsung devices therefore one must identify these incompatible services and other methods in smali and either remove them or recode them in order for the rom to function in a way that is compatible with the device for which you will be running the software on. Sometimes you can simply replace services from your original device's software as long as it is compatible and from the same Android version, but not always.
There is NEVER going to be a set of instructions that will apply to all ROMS. Period. This stuff is always ever-changing with each update that Samsung releases. This is why there can be no accurate "guide" to porting TouchWiz. Whoever says otherwise is not knowledgeable on this stuff at all.
Once the framework files are prepared and rebuilt properly then you will need to have knowledge of the stock system apps and what role they play in the software. Most system apps are cross compatible but some are device and/or carrier specific and must either be removed or replaced in order for the rom to boot and run without a complete meltdown with continuous FC's. Then you have CSC (customer service codes). This plays a major role in how the software will be setup on initial rom setup. Each specific device model will have it's own unique CSC, however most of Samsung's current CSC is identical between the current available top tier devices such as the N4, N5, S7 and N7. BUT each device will have it's own unique "values" within multiple files in CSC. Some Samsung devices are compatible with features that other Samsung devices do not support. Therefore you must have knowledge of this and make the necessary edits in order for the software features to be setup correctly without major malfunctions. One wrong value can actually cause the rom to not boot. You will need experience with this as well.
Next you may need to slightly modify the kernel's ramdisk to support a couple of additional framework files which is the case with the N7 software and probably the N5 as well. It's just a matter of adding a few file names to a text file, save, then recompile the zimage and place the modified kernel inside your rom zip. These types of things must be discovered by trial & error by people who are knowledgeable and have experience porting roms. But it goes to show that these little things can determine a successful or failed port. You never know what can cause the rom to not boot. There's so many pieces to the puzzle when porting.
Moving on to the build.prop and updater-script. There MUST be a lot of edits done to the build.prop and the same principal applies here. You MUST edit the build.prop in order for it to support the software AND your specific device model, cpu, security features, etc, etc. This is an art folks. Again... there is no "guide" for doing this properly. You must possess the mental aptitude to tackle this stuff. It's not for normal people The updater-script is a VERY VERY important part of the rom porting process because it contains the permissions and symbolic links for all of the critical system files and folders. You must manually edit the updater-script so that it sets the proper permissions and symbolic links for the files that are used in the current software you are going to run. You cannot simply use a stock device updater-script straight out of the kitchen for your specific device. It will not work due to other versions of TouchWiz will likely have additional or different files and folders in the rom. This will take a LOT of time to go over everything and make sure you covered everything and properly setup the updater-script.
Next there is the process of replacing critical and device specific libraries and bin files as well as kernel modules. Generally for Samsung devices, system/bin folder must contain all of the original files from the original stock software for your specific device. You might need to add additional files from the software you are porting. The same applies to the system/lib/modules. These modules MUST come from your device's original software. The libraries are very tricky because not all libraries can be from either your original stock software nor from the software you are porting. Simply put, this is going to be the single most time consuming process with a ton of trial and error. You must figure out which lib files must be used from your original software and which libs must come from the new ported software. Good luck figuring this out! :laugh:
This pretty much covers the initial areas of the system software that must be manually modified in order for the rom to actually boot.
As you can see, there's a lot of trial and error with porting roms. Believe me. Other people who ported the early N7 and S7 port ROMs have done a LOT of work and surely they have a lot of trial and error. These early port dev's deserve a lot of credit for these early discoveries without a doubt. Without their original trials and errors & hard work, there would be no other port roms. They shared their knowledge and it was a group effort in the beginning. You guys know who you are! :highfive: Much Thanks to all of you who figured out framework issues etc in the early stages of current TouchWiz. I learned a lot in this process in which I have never shared with the public simply because there's no point in giving information that others can't use due to lack of experience. Hopefully some people will read this and better understand what goes into porting these ROMs. At a later dat, I may write up a more detailed "guide" on current TouchWiz IF I feel there is a need and there is enough people willing to step up and help out the community in the future. This is the way XDA works. You have to pass the torch to win the race. No one person can conquer the world. Teamwork is the key to success in everything you do. Remember this. Thanks for reading.
Wow, very nice write up. Thanks!
I would be interested in a more detailed guide if and when you get to it. I'm always looking to expand my know - how.
Many thanks! :highfive:
Thanks for the post....
but you did not go in to ROM porting much at all... I'd love to read a in depth view of the " copy and paste " dev .
tx_dbs_tx said:
This will be focused primarily on the Sprint network capability since that is my current carrier. But these same basic steps will apply for all porting of TouchWiz.
GSM vs CDMA is another very important part of the porting process. When possible, ALWAYS choose software that supports your specific carrier and service type/technology!!! If you are on a GSM network then choose a GSM rom and same for CDMA. However CDMA technology here in the US is a bit different from other countries in regards to how it is setup in the software. Each CDMA carrier will have it's own unique code inside system files. Simply replacing csc and other files will do NOTHING to fix this, leaving you with either no data services or improper generic data services. The only way to do this right is to either start with software for your specific carrier or manually modify these values in multiple files throughout framework and system using the correct values from software specific for your carrier. No exceptions.
The other thing. You ideally want to port the same Android version that is currently available for your specific device because the original kernel and libraries, etc need to support the version of Android in which you want to port. When porting you will be using most of your original software's bin files, kernel, etc... so these files need to be compatible with the version of Android you want to port. Very important!
Click to expand...
Click to collapse
This was great. It was exactly what I was looking for. Ive being working on porting a gsm rom to my device N900P. But the only thing Ive found is copy and paste. Trying to find something on cdma is even harder. Ive just download your Ultimate Hybrid N7 to see if can get a clue on where to start. Deodexing telephony-common should be enough? Where else should start looking? If you could point me a direction would be great. Thanks
triskaw said:
This was great. It was exactly what I was looking for. Ive being working on porting a gsm rom to my device N900P. But the only thing Ive found is copy and paste. Trying to find something on cdma is even harder. Ive just download your Ultimate Hybrid N7 to see if can get a clue on where to start. Deodexing telephony-common should be enough? Where else should start looking? If you could point me a direction would be great. Thanks
Click to expand...
Click to collapse
Sorry for the late reply. To be honest, porting a gsm rom to work on a U.S. cdma carrier is going to require massive work. Forget about it. Start your rom project with cdma compatible software and save yourself the trouble. You'll win the lottery before you get a gsm rom ported over to cdma. Copy and paste isn't going to scratch the surface. Why not port a factory Sprint ROM for your Sprint note 3? Such as the Sprint N7, N5, S7 edge? It is already setup to work on the sprint network. It would save you a lot of time and effort.