I have downloaded and successfully build the AOSP for marshmallow (android-6.0.1_r79). Than I made some changes to the stockkeyboard (regarding to my other topic, but not relevant here). The file which I modified was this here:
packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java
I compiled the code and it was successful too. But than I realize I face some problems.
I mounted the system.img and get into the path: /system/app/LatinIME/
I decompiled the app to check if the modification there is available and here is the problem.
This APK does not contain any Java Sources?! Its just XML regarding to the layout. When I replace my old Stockkeyboard with this one, it is still perfectly working? So I got not clue what's going on.
Question regarding to this topic are:
How can I make a modification to the stock keyboard LatinIME
Building this new AOSP image with the new keyboard
And extracting the new keyboardj (APK) out of this image to install it on my device (Root permissions are of course available)
What I have tried:
Modyfing the following Java file: packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java
Compiling the complete project (make -j4 and just the keyboard: make -j LatinIME)
Extracting the system.img -> mounting it -> pulling /system/app/LatinIME/LatinIME.apk out of this
Replacing my own keyboard with the modified stock keyboard
My steps are as described not working. The keyboard appears and its working but the modification seems to be missing. Also by decompiling it, there are no Java sources within it.
you do:
cd packages/inputmethods/LatinIME
do your code changes
$mm -B
croot
adb root
adb remount
adb push out/target/product/your_product_name/system/app/LatinIME/LatinIME.apk
/system/app/LatinIME/
adb reboot
LatingIME.apk is about 18MB
You will find intermediate files ( the ones taken into compilation ) here :
out/target/common/obj/APPS/LatinIME_intermediates/
Here is the fresh and fully functional AOSP keyboard with glide typeing enabled
Related
I think the answer is No but I’m not 100% sure as I’m a newbie with Android SDK.
So, I downloaded adt-bundle-linux-x86-20140702 to my CentOS 6.5 machine. Following the documentation, I was able to create an AVD using ‘AVD Manager’ interface (using the eclipse binary).
I’m able to view my AVD that I created by running emulator -avd <name>.
I have a .apk file which I didn’t build but downloaded from a website (I don’t have the source code). If I would like to load this .apk into my emulator to see how it works, is it something that’s doable? If yes, may I know the steps please?
Many thanks in advance.
Update:
Following this link, I tried:
adb install /path/to/my.apk
which returns,
“failed to copy ‘/path/to/my.apk’ to ‘/data/local/tmp/my.apk’: No such file or directory”
I also tried copying /path/to/my.apk to the directory where adb is located. I created a /data/local/tmp directory as well with the same result. Perhaps, it’s looking for /data/local/tmp on the AVD (?). Not even sure if it is a compatible issue with the device/target/cpu configured on my AVD ..
Appreciate any help.
i have tried and searched for days and was unable to come up with any solution for my problem:
I am trying to install a .kl file in /system/usr/keylayout to remap some keyboard keys for my app. I have the proper .kl file in the right format: Vender_XXXX_Product_XXXX.kl and it works if i copy it by using root explorer.
But I want it to be install (without root) by installing my app. Which means it has to be include in the .apk file and copied during installation!?
My approach so far was either with using a receiver and the QUERY_KEYBOARD_LAYOUTS intent.
For that a .kcm file is needed. That did not work with my phone (Galaxy S3). I do not know why but it does not show the PHYSICAL_KEYBOARD settings item in settings :(
Anyways i think/hope the better way is by NDK:
I tried using the ndk and was able to integrate some native c into my application but no "source" files like my .kl file.
I was hoping that a device.mk file would somehow be able to copy my .kl file to /system like so:
device.mk
PRODUCT_COPY_FILES +=
$(LOCAL_PATH)/Vendor_XXXX_Product_XXXX.kl:system/usr/keylayout/Vendor_XXXX_Product_XXXX.kl
Is that at all possible? To use the NDK to "install" a file to /system automatically while installing the actual apk?
And if so how do you do that? I am confused about the whole makefile thing and NDK. Never use that before and I am quite bad with c.
If any of you guys know how to do what I am asking ... please let me know. It would be greatly appreciated!
It's not impossible to install a .kcm file with an apk package. In fact that is just how layout apps do it. You are on the right track with the QUERY_KEYBOARD_LAYOUT.
I wanted to install a .kl file, just like you, but I couldn't find any good info on it. So instead I just used the map keyword in my .kcm file, it has the exact same effect.
Check out my source here, where I allow the user to add the se_sv_dvorak layout kcm without rooting the phone: https://github.com/innsmouthrain/se_sv_dvorak
But I want it to be install (without root) by installing my app.
That is not possible. Apps do not have write access to /system/usr/, unless they are running as root.
To use the NDK to "install" a file to /system automatically while installing the actual apk?
It is doubly impossible:
Your app does not get control when installing
Code written using the NDK does not gain any additional OS rights, and so such code cannot write to /system/usr/, except when running as root
I built my own android images from source which works without errors.
Now I made some changes (mostly log messages) to core java files (in framework/base/services).
I can now run 'mmm framework/base/services/java' to compile and update the services.jar.
This seems to work without error.
When I now start the emulator (created by the inital build process) the changes are not reflected in logcat.
Therefore I think the modified services.jar is not included in the system image used by the emulator.
Is it possible to update these images with some command?
Do I have to completely rebuild everything or change the image manually?
For changing the image manually I found some tutorial here:
Modifying .IMG Files
That is really much work for just changing one or two lines of code...
I also tried using the following:
$ adb remount
$ ./adb push ~/android/out/target/product/generic/system/framework/services.jar /system/framework/services.jar
failed to copy
'/home/devusr/android/out/target/product/generic/system/framework/services.jar' to '/system/framework/services.jar': No space left on device
I think there is no space left because it is a fixed emulator image...
I once had the same problem, if i got your question correctly. Try using
mmm framework/base/services/java
make
Use make on the top android source folder to recreate the system images and install all relevant files.
Don't worry normally it won't rebuild everything.
I started to look into Android programming today and created a very small app that is supposed to play MP3s. The tools I used where the Android SDK and eclipse. The code executed flawlessly in the Android emulator but after exporting it and attempting to install the apk on my Samsung Galaxy S2 I received a message telling me there was an error when parsing the file.
Here is my phone's configuration: Android v2.3.3, installation from unknown sources = allowed, USB-Debugging = enabled. The target system for my project has been set to Android v2.3.3 as well and the CPU architecture of the AVD has been set to ARM (armeabi).
I signed the apk using a custom keystone when exporting it, as I initially thought the problem might be a debug key which wouldn't work on real devices.
I attempted to install the app using both, the internal file explorer and a custom explorer (ES File Explorer) but it didn't work for.
Suggestions on how to make my phone execute my custom apps would be highly appreciated. :)
First, since it's complaining about the .apk file, try opening the .apk file by renaming the extension to .zip. If you can rename the file, and open it normally in Windows Explorer, then that should indicate the file itself isn't corrupt.
Secondly, I would try installing by connecting your device via usb and using the command adb -d install "path-to-your-apk-file.apk". If this doesn't work, hopefully adb will spit out something more descriptive, and you can update your question with the error.
I found the answer to the parsing error on custom apk files here. Removing the required API level tag android:minSdkVersion in AndroidManifest.xml solved the problem.
How do I (forcibly) remove the stock android Phone application from the emulator instance?
I would especially like answers from people who have actually successfully removed the Phone application.
Removing the Phone application probably also necessitates removing the Contacts application, as they are tightly integrated, that is fine.
Solution
After much research it seems the only solution is to rebuild the Android SDK from source, as Maciej Pigulski answered.
After fetching the android source, remove Phone and Contacts from the Android makefile build/target/product/core.mk. And build the SDK as usual, i.e.:
. build/envsetup.sh
lunch generic-eng
make sdk
And in out/host/linux-x86/sdk you will have a zip file containg a fresh new sdk ready for use in e.g. Eclipse.
I successfully remove Phone apps WITHOUT rebuilding the SDK (very long op...)
You can edit you system.img in your SDK (located for ex : ~/android-sdk-linux_x86/platforms/android-10/images/system.img) corresponding to the system part of your emulator ( Phone apos is located at /system/apps/Phone.apk)
I launched the emulator, connect with adb to the emulator shell. I removed the packaged /system/apps/Phone.pak after remounting the system partition with read/write option ( mount -o rw,remount /system /system )
I push into my emulator the mkfs.yaffs2 tools compiled for arm found here (http://code.google.com/p/android-group-korea/downloads/detail?name=mkfs.yaffs2.arm)
use this tools to recreate my system.img in my emulator shell:
mkfs.yaffs2 /system /sdcard/system.img
pull the /sdcard/system.img into my PC. Replace the system.img of the emulator (~/android-sdk-linux_x86/platforms/android-10/images/system.img) and restart the emulator.
The Phone app is Gone!
I have an idea how this could be done but this is not an easy way.
It requires source code of the Android OS you need an emulator for. Then in the make files you can disable including of the Phone application to the output image and build the OS with 'make sdk' task. This will produce an SDK (like ones available from the Google site) with the binaries that has Phone application excluded. Then when you will create an emulator with this SDK it wont have the Phone.apk.
Painful but if you really need it, give it a try.
If you have root acces you can remove the .apk file that provides this app. You would have to look around in the folders on the device where it is installed.
It may be necessary to re-compile the Android OS that is running on the emulator. During the compile the default apps are rolled up into the build so it would be a matter of getting the egg before the chicken... or killing the chicken before it lays the egg...