[Q] build error - frequency/isIBSS cannot be resolved or is not a field - Java for Android App Development

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

Related

[Q] Making app compatible with older Android version?

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.

[Q] Galaxy s4 I9505 with Google edition andriod

Hello guys, i just have a (few) question(s)
So, last week i installed Google Edition Andriod Kitkat 4.4.4 on my galaxy S4 I9505.
This rom is till now, still amazing, fast and better than touchwiz in any way. But i can't seem to find on the internet how and which version of xposed framework i need to install, since it is per model (i think?) which model do i choose?
since i have a Galay S4 but my rom is not from a galaxy S4, i get confused which one i have to install.
Some links to downloads would be great!
Thanks in advance
Dylan
dylanbos1996 said:
Hello guys, i just have a (few) question(s)
So, last week i installed Google Edition Andriod Kitkat 4.4.4 on my galaxy S4 I9505.
This rom is till now, still amazing, fast and better than touchwiz in any way. But i can't seem to find on the internet how and which version of xposed framework i need to install, since it is per model (i think?) which model do i choose?
since i have a Galay S4 but my rom is not from a galaxy S4, i get confused which one i have to install.
Some links to downloads would be great!
Thanks in advance
Dylan
Click to expand...
Click to collapse
Hi mate
Basically it works in any android 4.0 + base rom device see from one of his threads
For which devices/ROMs does it work?
I develop the Xposed framework based on the AOSP sources. I'm personally using CM10.2 on an I9100 (Samsung Galaxy S2, bought in Germany). Basically, it should work on any phone which with a ROM based on Android 4.0 or later and an ARM or x86 processor (this is the processor architecture, almost all smart phones and tablets have either of those). Exceptions might be ROMs which are different from the original Android code in some very internal, central code parts (which don't need to be touched for most theming and enhancement modifications). But this is related to the ROM, not the phone itself.
The modules target higher-level code, so they are more likely to be incompatible with your ROM. Basically, the question is whether the methods and resources which the module modifies are similar on your ROM and on the developer's ROM. Let's say a module needs to modify the result of a certain method call. For this, it needs to specify the exact name and parameters that identify that method. If the in your ROM, an additional parameter has been added, the module can't find the method anymore and won't work. If the method can still be found, it will probably work (unless the rest of the app/ROM has changed too much).
There is not definite answer whether it will work. Just try it (of course, making a nandroid backup before is never a bad idea). If it doesn't work, just disable the module. You might want to inform the module developer (not me!) about this fact and provide details (e.g. a logcat and/or the content of /data/data/de.robv.android.xposed.installer/log/debug.log).
Try with latest 2.6.1
http://forum.xda-developers.com/xposed/xposed-faq-issues-t2735540
http://forum.xda-developers.com/xposed/xposed-installer-versions-changelog-t2714053
Thank You!
MAX 404 said:
Hi mate
Basically it works in any android 4.0 + base rom device see from one of his threads
For which devices/ROMs does it work?
I develop the Xposed framework based on the AOSP sources. I'm personally using CM10.2 on an I9100 (Samsung Galaxy S2, bought in Germany). Basically, it should work on any phone which with a ROM based on Android 4.0 or later and an ARM or x86 processor (this is the processor architecture, almost all smart phones and tablets have either of those). Exceptions might be ROMs which are different from the original Android code in some very internal, central code parts (which don't need to be touched for most theming and enhancement modifications). But this is related to the ROM, not the phone itself.
The modules target higher-level code, so they are more likely to be incompatible with your ROM. Basically, the question is whether the methods and resources which the module modifies are similar on your ROM and on the developer's ROM. Let's say a module needs to modify the result of a certain method call. For this, it needs to specify the exact name and parameters that identify that method. If the in your ROM, an additional parameter has been added, the module can't find the method anymore and won't work. If the method can still be found, it will probably work (unless the rest of the app/ROM has changed too much).
There is not definite answer whether it will work. Just try it (of course, making a nandroid backup before is never a bad idea). If it doesn't work, just disable the module. You might want to inform the module developer (not me!) about this fact and provide details (e.g. a logcat and/or the content of /data/data/de.robv.android.xposed.installer/log/debug.log).
Try with latest 2.6.1
http://forum.xda-developers.com/xposed/xposed-faq-issues-t2735540
http://forum.xda-developers.com/xposed/xposed-installer-versions-changelog-t2714053
Click to expand...
Click to collapse
Thank you so much for your help. I think it is pretty clear for me now.
Dylan
dylanbos1996 said:
Thank you so much for your help. I think it is pretty clear for me now.
Dylan
Click to expand...
Click to collapse
Any time mate.

How to have official DocumentFile restrictions on Roms?

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.

How to build AOSP for Motorola devices?

I am having trouble finding decent instructions for getting the sources for a standard build for Motorola devices, specifically for athene.
I have built for Freescale products before and it usually involves some combination of repo init and patches, but that doesn't seem to be the case for Motorola.
I know the kernel and other sources are available on Github (https://github.com/MotorolaMobilityLL), but I don't see a manifest repository there. Nor can I find a device repo.
The closest thing to instructions I found was this readme (https://github.com/MotorolaMobilityLLC/readme/blob/master/MMI-MPJ24.139-23.4.txt) (xda wont let me post links, I'm too new a user here).
I am starting to suspect that Motorola is being as lazy as possible and only fulfilling the bare minimum of open source obligations, and thus doesn't provide a device repo, or manifest repo, etc.
Is that the case? I am new to running builds for standard phone manufacturers - are ROM developers around here forced to do legwork filling in what the manufacturers refuse to publish?
Or am I just missing the rest of the instructions from somewhere?
I have the same issue, did you ever manage to successfully complete a build? Thanks.
TheGreatCabbage said:
I have the same issue, did you ever manage to successfully complete a build? Thanks.
Click to expand...
Click to collapse
Nope, my impression of the situation remains the same, though I have not re-investigated. I would like if someone more knowledgeable confirmed though.
It is a shame, as I would really like a "known good" base to work off of and put in root support and remove unnecessary softwares in a legitimate way.
You *can* build LineageOS for athene: (https://wiki.lineageos.org/devices/athene/build)
I ran LineageOS for several months, but eventually switched back to stock. Has some strange issues in regards to texting (seems to only work when making a call).
Thanks for your reply. I've just managed to build Lineage OS for my device, and it seems to work ok.
I was previously using Resurrection Remix OS (which I didn't build, just downloaded a zip) and it worked very well, so if I have any issues with Lineage then I'll try to restore my TWRP backup of RR.
I wish I could use the AOSP codebase directly, though...

Samsung M30s Randomly Restarts After Software Updates - Potential solution?

Hi,
My M30s started randomly restarting after a software update. I could not find solutions here when I searched but it appears a lot of people on the internet having been facing similar issues for quite a few months now. The Samsung community forums are full of multiple messages and Samsung is pushing people to get to their phones to the service centers and are getting the motherboards replaced for free if the warranty is valid (or at a cost of INR 9,000 otherwise).
In any case, I found another poster on the Samsung forums who seems much more tech savvy than I am. And he seems to have solved the problem on his phone by changing 2 lines of code in the Linux kernel wand rebuilding the OS afterward.
Like I said, I am not tech savvy enough for this, but I thought I would post the link here because I could not find this particular fix here.
Re: READ THIS IF YOUR SAMSUNG GALAXY M30S KEEPS RANDOMLY FREEZING AND RESTARTING AUTOMATICALLY
To add a bit of my research into this problem: My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the...
r2.community.samsung.com
(Here is the text from the post in case you are not able to open it)
-----------------------------------------------------------------------
To add a bit of my research into this problem:
My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the OS Samsung has released on their open-source portal. I can use this source code to fix and rebuild the OS to prevent the issue from happening.
The issue and the fix is well known among the Samsung M30s community. It's two lines of code that need to be changed to prevent at least one of the common reasons for frequent reboots.
It takes a lot of work for a private user to fix those two lines of code, because Samsung releases source code that's non-trivial to compile and actually run on your device afterwards.
Samsung's Android 11 still ships with the same old kernel version (4.14.62) as their Android 9 (4.14.62), released back in 2018. There might have been some fixes between 4.14.62-19694174 and 4.14.62-20748039 introduced by Samsung in the meantime.
Regardless, this fix is not part of the source code for M307FNXXU2BTC6 (linked above) that's been released by Samsung in June 2020. Therefore, it doesn't seem like Samsung is actually applying all fixes to their kernels.
The kernel itself should have been upgraded to a higher version - at least to 4.19 - to fix bugs that's been plaguing users of Exynos 9611 chips running on Linux v4.14 for a long time.
Samsung: Please apply this fix to your Android kernels and push the update to your customers. Thank you!
References about the "fix NULL pointer deref in smaps_pte_range()":
Mainline Linux kernel fix:
[4.19,248/361] mm: /proc/pid/smaps_rollup: fix NULL pointer deref in smaps_pte_range()
https://lore.kernel.org/patchwork/patch/1010971/
Google Android Linux kernel backported this change in 2019 :
https://android.googlesource.com/kernel/common/+/043c92bd0517e0018cb6307390eb9c36b864fb9f
--------------------------------------------------------------------------------------
EDIT: After more hours of experimenting I have managed to compile a kernel with the patch mentioned in this post. I can confirm that I faced no reboots since I flashed my phone with this new kernel. Hence, I can confirm this fix really prevents frequent reboots.
superstarksa said:
Hi,
My M30s started randomly restarting after a software update. I could not find solutions here when I searched but it appears a lot of people on the internet having been facing similar issues for quite a few months now. The Samsung community forums are full of multiple messages and Samsung is pushing people to get to their phones to the service centers and are getting the motherboards replaced for free if the warranty is valid (or at a cost of INR 9,000 otherwise).
In any case, I found another poster on the Samsung forums who seems much more tech savvy than I am. And he seems to have solved the problem on his phone by changing 2 lines of code in the Linux kernel wand rebuilding the OS afterward.
Like I said, I am not tech savvy enough for this, but I thought I would post the link here because I could not find this particular fix here.
Re: READ THIS IF YOUR SAMSUNG GALAXY M30S KEEPS RANDOMLY FREEZING AND RESTARTING AUTOMATICALLY
To add a bit of my research into this problem: My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the...
r2.community.samsung.com
(Here is the text from the post in case you are not able to open it)
-----------------------------------------------------------------------
To add a bit of my research into this problem:
My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the OS Samsung has released on their open-source portal. I can use this source code to fix and rebuild the OS to prevent the issue from happening.
The issue and the fix is well known among the Samsung M30s community. It's two lines of code that need to be changed to prevent at least one of the common reasons for frequent reboots.
It takes a lot of work for a private user to fix those two lines of code, because Samsung releases source code that's non-trivial to compile and actually run on your device afterwards.
Samsung's Android 11 still ships with the same old kernel version (4.14.62) as their Android 9 (4.14.62), released back in 2018. There might have been some fixes between 4.14.62-19694174 and 4.14.62-20748039 introduced by Samsung in the meantime.
Regardless, this fix is not part of the source code for M307FNXXU2BTC6 (linked above) that's been released by Samsung in June 2020. Therefore, it doesn't seem like Samsung is actually applying all fixes to their kernels.
The kernel itself should have been upgraded to a higher version - at least to 4.19 - to fix bugs that's been plaguing users of Exynos 9611 chips running on Linux v4.14 for a long time.
Samsung: Please apply this fix to your Android kernels and push the update to your customers. Thank you!
References about the "fix NULL pointer deref in smaps_pte_range()":
Mainline Linux kernel fix:
[4.19,248/361] mm: /proc/pid/smaps_rollup: fix NULL pointer deref in smaps_pte_range()
https://lore.kernel.org/patchwork/patch/1010971/
Google Android Linux kernel backported this change in 2019 :
https://android.googlesource.com/kernel/common/+/043c92bd0517e0018cb6307390eb9c36b864fb9f
--------------------------------------------------------------------------------------
EDIT: After more hours of experimenting I have managed to compile a kernel with the patch mentioned in this post. I can confirm that I faced no reboots since I flashed my phone with this new kernel. Hence, I can confirm this fix really prevents frequent reboots.
Click to expand...
Click to collapse
Amazing work brother, everyone is facing this restart problem but you can help
Can you compile the latest kernal(4.14.113) and share it with our M30s community.
razs.originals said:
Amazing work brother, everyone is facing this restart problem but you can help
Can you compile the latest kernal(4.14.113) and share it with our M30s community.
Click to expand...
Click to collapse
Like I said in my post, I am not tech savvy enough to do this. And I am wondering if this problem has been widely reported even. This is the place I expected to find lot of buzz but i dont see any
Everyone is upset with this Samsung's reboot problem. Anyways we users will find a solution.
I am a M30s owner. I have done this on my phone and it's a temporary fix. Atleast try this and wait for the official fix. It's better to have something than nothing.
How To Fix Restart Issue On Galaxy M30s, M31, M31s, A50, A50s? (Updated) - SamsungSFour.Com
How To Fix Restart Issue On Galaxy M30s, M31, M31s, A50, A50s? (Latest Method)
www.samsungsfour.com

Categories

Resources