I want to find classes in a certain package for creating objects using reflection. So basically, I have working code for plain JAVA applications. The problem is that
Package.getPackages()
and
this.getClass().getClassLoader().getResource(packageName);
does not seem to work for Android as I always get an empty array in the first case and null in the second. However, I tested the code in common JAVA using Unittests with the same test data and it worked.
Does anybody know a workaround? I know that there is a package manager, however I don't need a list of installed packages that refer to an APK. I want to enumerate all package URLs within an APK.
Regards,
Florian
Related
Im currently working with the xposed framework on Android 8.0. How is it possible to find all the method names of an app to hook? For example, i want to hook the method that is called if i add a new contact. Would it be possible to reverse engineer the apk to insert an logcat output into all methods, that shows which method was called?
There a various methods for identifying the relevant methods.
The first and most important one is knowledge of the official Android API. All Java/Kotlin based apps at some point use the classes and methods defined i the API. And the most important fact is that because the Android API belongs to Android and not to the app it can not be obfuscated.
Second you can reverse engineer the app itself using tools like Jadx, apktool, Ghidra, JEB... Just make sure that the tool you use does not rename the class names (e.g. to avoid name collisions or make obfuscated class and method names better readable) or at least allows you always show you the original class and method name. Because trying to hook a method by it's name will fail if you use a name generated by the APK reversing tool.
Also a very helpful tool that allows to identify a lot o the internal on a running program is frida-trace. As long the the executed app has no anti-debugging or anti-frida measures in place you can attach frida-trace at any time to an app on a rooted device and create execution traces you can later use to hook the methods using xposed or directly using frida.
I would like to determine which third-party SDKs (like Mixpanel, Google Analytics, Facebook SDKs) are being used in an app, if any. Is there a way to find this out?
Assume for the purposes of this question that I am not the developer of the app, and therefore I don't have access to the source code.
You can use a service like Appbrain to find that out. It's free for the first few lookups.
It's not possible to reliably enumerate the libraries used by an application, for a few reasons.
The main reason is obfuscation: If a user turns on Proguard or R8, they will rename the library's classes, potentially in such a way as to make them unrecognizable.
Another reason is that there's simply not a comprehensive list of every Android library in existence, or a mapping of class names to libraries.
However, if you did want to try to do this, you'd want to retrieve the application's class files and then hunt through them for the start of package names from libraries you care about (as obfuscators are less likely to rename the entirety package names, though they still might). For example, if you wanted to see if an application uses okhttp3, you'd look to see if there are is an okhttp/okhttp3 folder (for the package okhttp.okhttp3).
You could maybe even automate this by finding a list of popular Maven/Gradle packages, downloading them, extracting the class names, and using that as your dataset.
In short: Is there a supported way to create an Android project for eclipse (as you would get via the new Android project wizard) programmatically? Or if not supported, then is there any way at all? (this is being done within an eclipse plugin)
I've been trying to do this for a while, and it is turning out to be much more difficult than expected. I took a look at the source for both the New and the Import wizards for Android projects, and found that they both use the NewProjectCreator class. There seem to be two ways to use this class; one is via the static "create" method, and the other is to construct an instance of NewProjectCreator and call "createAndroidProjects". However, I'm having trouble getting ahold of all the necessary parameters for either of these. The static method requires both an IAndroidTarget and a ProjectPopulator, neither of which I can find implementations of (There is an anonymous implementation of ProjectPopulator in the NewProjectWizard class, but pasting this into my code is disastrous in the number of classes and fields it can't find). The instance method on the other hand requires an IWizardContainer, but I would like to be able to do this without bringing up a wizard.
At the other end of the spectrum, I've tried simply adding and Android nature to the project, but this causes all sorts of build errors, since it doesn't actually change the setup of the project to reflect whatever the Android standards are. I guess another option is to take this route and try to set up the whole project manually, but I don't know if there are any guidelines for this, or whether the project standards are likely to change.
Does anyone know how to do this? Thanks in advance!
I am a Computer Science undergraduate student and I am creating an Android app that using an API to interact with an execution server.
The server takes a xml file and do various stuff with it(get data, process data etc.)and then gives back data as output. Both input and output are exchanged via this API.
The problem is that the API references code from javax.xml.bind, for example, JAXBContext while android doesn't have javax.xml.bind package in its core. (a well known issue)
Feasible solutions on the internet seems to be repackaging the code I need, but I don't know exactly what suppose to be.
Since the API reference classes in javax.xml.bind and javax.net, I guess I have to extract code from these 2 packages and make them part of the API (I have access to API source) and then repackage the API. However, I guess classes inside javax.xml.bind might have dependencies on other classes that not supported by Android, so does javax.net. (Please forgive me if this is stupid thought...)
So anyone know : whether there are classes, which codes in javax.xml.bind and javax.net depends on, not supported by android ?
Bit of tricky question really..
I will be really appreciated if you can provide a work around that enable a Android app to call an API that reference codes inside javax.xml.bind.
Try JiBX (http://jibx.sourceforge.net/), it's a small and fast footprint, Android compatible, XML binding framework.
I ended up with repacking those package which exists in standard Java library but not in Android. Basically, just get source code of all those missing packages and then put them into the API source and rename them into a name that is different from the original one and then change corresponding code in API that reference these methods as well (you have to use a different name, otherwise code reference methods in these package will still looking for methods in the core Library (i.e Android API)
Anyway, hope it helps. If you have the same problem.
If you have any better suggestion. Please share it!
I am a new developer for android programming. I understand android SDK does not contain all classes from android source code. For example, AtCommandResult.class is missing (hiding) from android.bluetooth package in the SDK.
Sometimes, however, I want to use the hidden code in my app and I wonder what would be the best way to do that. One approach I can think of would be to include its corresponding source code in my project with different package name to avoid conflict with existing core. But problem with this approach would be I have to maintain the code by myself from that point. One or two classes are OK but you know where I am going.
Is there any better way other than bothering google to include the code in the SDK? Thanks in advance.
You may want to use a .AIDL file:
http://developer.android.com/guide/developing/tools/aidl.html
Those can already be used to access for example in Telephony functions.
Code example here:
http://code.google.com/p/auto-answer/source/browse/trunk/src/com/android/internal/telephony/ITelephony.aidl?r=13