Forking AOSP Keyboard and Compiling with Android Studio - General Questions and Answers

Hello all,
I am interested in forking the AOSP keyboard and compiling it with Android Studio, but I am having a hard time doing so.
I have already cloned the repo from here: https://android.googlesource.com/platform/packages/inputmethods/LatinIME
When I try to open it in Android Studio however, I am running in to issues. I found online that I apparently need to import it as an Eclipse project to add Gradle to it, which I have tried as well, but I still cannot get the project recognized. I also tried importing just the "java" folder, which worked after I fixed the Gradle errors and the missing class errors by copying the classes from the other folders in to the appropriate location in the java folder. Doing that, I was able to compile the keyboard, but trying to use it results in it crashing with the following error in logcat: Could not load native library jni_latinime
What is wrong and does anyone know how I can fix it? Ideally, I would like to use a project structure that does not involve moving other classes around as I have been doing so that I can stay up to date with the official repo with minimal merge conflicts. Does anyone have any advice?
Thanks in advance!

Related

Please help editing android source apk

I've been searching for about an hour now and haven't found a thing. I think I'm missing something extremely obvious but I'm completely stumped. I'm trying to simply create a new android project in eclipse from an existing source, the Launcher found in the android 2.0 source. It creates the new project with no problems and everything looks like it is supposed to look except I have about 74 errors among various different classes. I've looked through some of the errors and many are variables that haven't been declared and others are references to classes that don't exist. I've tried numerous times with several different app sources with the same problem in every single app. I've even tried downloading the source for separate apks and the same thing happens. What am I missing?!
I'm pretty new to coding android apps but decent with java. My biggest problem is just getting the apps to compile without even making any modifications yet! Any help is appreciated
matt_stang said:
...I'm trying to simply create a new android project in eclipse from an existing source, the Launcher found in the android 2.0 source...except I have about 74 errors among various different classes.
Click to expand...
Click to collapse
The android.jar which is linked in to the project by ADT only exposes the public Android API (as seen in the official documentation.) Launcher, and other "system" apps included with the platform, almost invariably access a number of private APIs which are not exposed in the SDK, and cannot be built with ADT--at least, not easily.
As it turns out, android.jar can be edited to expose all those private APIs, which is something Brut.all has worked on as part of apktool, but he hasn't done this for an entire android.jar.
Your other alternative--and practically speaking, the only current alternative--is to build it the official way, by compiling a complete platform on Linux using the full Android build process, and including your Launcher customizations. After building the whole system once you can build just the desired APK, as I understand.
olearyp said:
The android.jar which is linked in to the project by ADT only exposes the public Android API (as seen in the official documentation.) Launcher, and other "system" apps included with the platform, almost invariably access a number of private APIs which are not exposed in the SDK, and cannot be built with ADT--at least, not easily.
As it turns out, android.jar can be edited to expose all those private APIs, which is something Brut.all has worked on as part of apktool, but he hasn't done this for an entire android.jar.
Your other alternative--and practically speaking, the only current alternative--is to build it the official way, by compiling a complete platform on Linux using the full Android build process, and including your Launcher customizations. After building the whole system once you can build just the desired APK, as I understand.
Click to expand...
Click to collapse
But I already have the whole system built on my mac.. so maybe is it a matter of pointing the project to the right directory for the private APIs? Or importing a android.jar from the built source to the project..? I'm very confused
matt_stang said:
But I already have the whole system built on my mac.. so maybe is it a matter of pointing the project to the right directory for the private APIs? Or importing a android.jar from the built source to the project..? I'm very confused
Click to expand...
Click to collapse
There is no android.jar with what you're looking for. If you already have the entire platform--either http://android.git.kernel.org/ or the CM source repository--just modify that, then build from the command line. AFAIK, you have to build from the command line, though, using `make'.
olearyp said:
There is no android.jar with what you're looking for. If you already have the entire platform--either http://android.git.kernel.org/ or the CM source repository--just modify that, then build from the command line. AFAIK, you have to build from the command line, though, using `make'.
Click to expand...
Click to collapse
That makes a lot more sense. Thanks

[Q] How to invoke internal APIs

Hi guys,
I know that there are a lot of people have been asking the same question but I couldn't find the right answer for it, except "it is not recommended". I understand why such approach is not recommended so let's not discuss that issue again here.
What I really want to do is to test some internal APIs in my app. We will, in the future, build our own ROM, but at the moment, we want to test some internal features to see if they serve our purposes. But once I import any internal Java class into my app's code, Eclipse displays errors (of course). And I am trying to get around by either copying that source code part from AOSD to our app or looking for some .jar files so that we can put them into Build Path and compile. But both ways didn't work.
Is there anyone here can help me to solve the problem?
And let's me know if I posted in the wrong forum.
reddevil00 said:
But once I import any internal Java class into my app's code, Eclipse displays errors (of course). And I am trying to get around by copying that source code part from AOSD to our app
Click to expand...
Click to collapse
That's what I did for an app just yesterday so I suppose that generally this approach is working. Though I had to include a hand full of classes until all errors were gone.
If you don't tell the detailed error messages then I guess noone can help any further.
Thanks ramdroid77. Seems that I got the right person
Ok, I want to use the following classes:
com.android.internal.telephony.Call
com.android.internal.telephony.CallManager
com.android.internal.telephony.Phone
Since these files depend on other classes as well, so I decided to copy the whole source code (.java files) in framework/base/telephony/com to src folder in my project. There were errors such as in AdnRecord.java "The method readStringArray(String[]) in the type Parcel is not applicable for the arguments()...".
But before trying to fix the errors, I realized that this seems not the correct way to do because those copied Java files will be compiled as well. But what I need is only the reference implementation of those classes to get over the compilation. When the app is run, it will invoke the real classes. That's why I changed to the second way looking for some .jar files that I can add to Build Path.
Btw, which approach did you use? Can you tell me roughtly how you did it? I'll follow and report the specific error messages then.
reddevil00 said:
But before trying to fix the errors, I realized that this seems not the correct way to do because those copied Java files will be compiled as well. But what I need is only the reference implementation of those classes to get over the compilation. When the app is run, it will invoke the real classes. That's why I changed to the second way looking for some .jar files that I can add to Build Path.
Click to expand...
Click to collapse
So compile all Android java files to jar and add it to classpath of your application.
Thanks guys. Sorted it out.
I had compiled Android source code earlier so I just needed to find those class files in the compiled source code and added to the classpath. Now it is working.

Google API for Java

I'm relatively new to programming and am currently learning Java.
Google provides their API in Java for their various products. I downloaded it, followed the instructions to use ANT to get it all ready to go, but I'm stuck on how to actually start using it. I can't get their libraries to import into my programs using the JVM compiler. It just says a bunch of, "that package doesn't exist", and things of that nature. I can't even get Google's sample code to load any of the API packages.
How does one actually use the API once it's all extracted and in the C:\Program Files\Java\gdata folder? Can I not use the JVM compiler? I had to use ANT to set it all up... does that mean I have to somehow use ANT to use the API? I'm a little confused.
If somebody could write up a step-by-step on how to start using the API, that would be so awesome.
thesecondsfade said:
I'm relatively new to programming and am currently learning Java.
Google provides their API in Java for their various products. I downloaded it, followed the instructions to use ANT to get it all ready to go, but I'm stuck on how to actually start using it. I can't get their libraries to import into my programs using the JVM compiler. It just says a bunch of, "that package doesn't exist", and things of that nature. I can't even get Google's sample code to load any of the API packages.
How does one actually use the API once it's all extracted and in the C:\Program Files\Java\gdata folder? Can I not use the JVM compiler? I had to use ANT to set it all up... does that mean I have to somehow use ANT to use the API? I'm a little confused.
If somebody could write up a step-by-step on how to start using the API, that would be so awesome.
Click to expand...
Click to collapse
Judging from your post, you seem to be referring to the GData APIs. It's worth noting that Google is pushing Google APIs Client Library for Java for all new Google JSON APIs.
These APIs + samples are built with Maven2 and are pretty easy to setup.
Also judging from your post, you might want to get up to speed with basic java stuff like project setup in your IDE (Eclipse / IntelliJ ?), Build tools (Maven / ANT). Learn those things first before getting into the Google APIs. Go to the maven site and see how you can build a simple project. See how to import that project in Eclipse, and checkout the Maven plugin for Eclipse.
Most of the samples for Google APIs Client Library for Java (ex: The Books API Sample) provide step by step instructions on how to get things up and running (starting with checking out the code from the google versioning control to building it and running the sample on your environment).
Hijacking this threat a bit, but I'm also learning about APIs, Facebook and Twitter in particular.
With regard to android and java, I've done the tutorial for logging into facebook and posting basic status update but don't really understand the code; which parts are the API?
Really appreciate it if you could point me to another thread or site that explains how to use the API. I'm stuck on how to create a method that does event creation for facebook.
Thanks in advance!

Android Malware Analysis

Hi folks,
I have just started exploring the prospect of Android Malware Analysis recently. As of now I have mostly done Static Analysis using tools like APKTool, APKManager, Dex2Jar, Jd-GUI. Cheers to people in the forum who have contributed with these tools and cleared the initial questions, that was really helpful.
Recently I was trying to analyze a malware that sends SMS to the C&C individuals, using the above mentioned tools I changed the C&C number which was hardcoded in the code to the port number of an emulator on my system. I was able to se the SMSes being diverted to the emulator.
I wanted to try something at the next level now, I was thinking of loading the apk in eclipse and putting breakpoints in the code so that I can catch the different activities. A scenario would be before the SMS is sent out of the app the code stops executing at my breakpoint so that I can view what is going on. Hoping that this feels similar to debugging an exe in OllyDBG. I hope I got my point right.
Right now I followed a number of tutorials online and imported the apk code onto eclipse. I have been following a tutorial highlighted here
http://kkinder.com/2011/11/27/so-you-want-to-reverse-engineer-an-android-app-apk/
So right now I have .smali code as well as java code ( which I am getting by opening the apk as a jar file in JD GUI and saving from there as mentioned in the tutorial). The problem is I am getting errors in every java file that I import in eclipse.
Is there a better and easier way to debug apk files on eclipse, or rather is there a tool which I can use to do something like adding breakpoints before an app sends out an sms for instance.
Pardon me for the long post but i thought ill provide as much information as possible so that you guys can help.
Thanks in advance :good:
Bump
skeptre said:
Hi folks,
I have just started exploring the prospect of Android Malware Analysis recently. As of now I have mostly done Static Analysis using tools like APKTool, APKManager, Dex2Jar, Jd-GUI. Cheers to people in the forum who have contributed with these tools and cleared the initial questions, that was really helpful.
Recently I was trying to analyze a malware that sends SMS to the C&C individuals, using the above mentioned tools I changed the C&C number which was hardcoded in the code to the port number of an emulator on my system. I was able to se the SMSes being diverted to the emulator.
I wanted to try something at the next level now, I was thinking of loading the apk in eclipse and putting breakpoints in the code so that I can catch the different activities. A scenario would be before the SMS is sent out of the app the code stops executing at my breakpoint so that I can view what is going on. Hoping that this feels similar to debugging an exe in OllyDBG. I hope I got my point right.
Right now I followed a number of tutorials online and imported the apk code onto eclipse. I have been following a tutorial highlighted here
http://kkinder.com/2011/11/27/so-you-want-to-reverse-engineer-an-android-app-apk/
So right now I have .smali code as well as java code ( which I am getting by opening the apk as a jar file in JD GUI and saving from there as mentioned in the tutorial). The problem is I am getting errors in every java file that I import in eclipse.
Is there a better and easier way to debug apk files on eclipse, or rather is there a tool which I can use to do something like adding breakpoints before an app sends out an sms for instance.
Pardon me for the long post but i thought ill provide as much information as possible so that you guys can help.
Thanks in advance :good:
Click to expand...
Click to collapse

[help][reboot-app] ubuntu dual boot installer [reboot-app][help]

hey guys
so there is a solidly large amount of new devices being ported to ubuntu touch and as the app has been in development hell i would like to bring it back and rework it to allow the great new devices thats been ported to it to use the app. I ran across team humpolecs original source code and i have it downloaded and ready to upload back to github.
i have been working on it and its pretty old stuff dating back to kitkat. wow. any way so adding new devices to the java and changing the adress to the ubports system-image site is pretty steaight forward. but im having trouble with a couple code snippets that are erroring my compilation but still to make it fully worthwhile i need to know how to get the boot and recovery partitions of the new devices that are popping up.
Also considering my own device has avb partitioning will this be a problem getting going. looking for volunteers to help me reboot the app any takers?
the main problem im having is fixing the deprecated progressDialog snippet. ive seen some examples and fixes but no matter what i try i get errors

Categories

Resources