I want to edit the reformating which comes with the official Android ADT in eclipse, is this possible?
I want, for example, remove the break after a long class decleration.
I have the official AOSP source on my computer and found a the android-formatting.xml, is it the same as in the Android ADT? If yes, How can I override the ADT formatting and can use my custom file which I can import (a modified android-formatting.xml).
I want, for example, remove the break after a long class decleration.
I am not aware that Android specifies any formatting for Java classes. That is handled by Eclipse and can be modified from within Eclipse itself (Preferences > Java > Code Style > Formatter).
Related
I'm looking for some support and tips on how properly share the Kotlin formatting conventions in an Android project that is being opened in both Android Studio and IntelliJ IDEA by different team members. I'd like to force the usage of Kotlin coding conventions; and I'd like to avoid asking every developer in the team to change their settings in IDE configuration of the Code style.
So far I've been following 2 approaches:
Commit the .editorconfig file to the repository - but this file does not cover all the settings that we would like to share between developers and IDEs.
Commit the files that are located under .idea/codeStyles/ directory in the root folder of the project. This seems to cover the cases that were not handled by 1), but the Project.xml files seems to be altered every time when the project is opened in IntelliJ (if the Project.xml has been created in Android Studio, and I suspect vice versa as well).
Moreover, I can see some inconsistencies when I try to format the same Kotlin source file in Android Studio and IntelliJ. Could it be that both IDEs contain different sets of rules of Kotlin official coding conventions?
Another way to share formatting options is via code style xml.
After you set all the options in your IDEa (in Editor -> Code Style -> Kotlin), click gear button next to Scheme and choose Export -> IntelliJ IDEA code style XML like shown on a picture:
Share this file with your colleagues, and they can import those settings in a similar way by clicking Import Scheme.... Since Android Studio is based on IntelliJ IDEa, it will understand this file.
I'm trying to implement this https://github.com/mik3y/usb-serial-for-android/blob/master/UsbSerialExamples/src/com/hoho/android/usbserial/examples/SerialConsoleActivity.java in my project but there is something wrong with this sample.
Line 121:
sDriver.setParameters(115200, 8, UsbSerialDriver.STOPBITS_1, UsbSerialDriver.PARITY_NONE);
Why I can't see this method setParameters()?
I had the same problem when I tried to use the example project. The problem I had was that I was using usb-serial-for-android-v010.jar that you can download from the git repository. I think it was created using an older version of the project and doesn't support some of the newer features like setParameters. If you downloaded the example project there should be a folder inside called UsbSerialLibrary. Import that into your IDE and add it to your build path: (Eclipse) Properties>Java Build Path>Projects>Add. This should let you use setParameters.
Also, the API was recently refactored so you may want to look at that.
Refer to:
How can I set up Vim for Android development?.
Autocompletion of vim (omnicomplete) is powerful tool of vim,
but there was no tags of android library...,
how do i set my vim for android development?
The most powerful way is using eclim which is an interface to eclipse.
Pressing C-x C-u in insert mode shows the auto-completion popup.
The drawback is that you have to install the whole eclipse IDE.
If you prefer a slim solution you can use javacomplete. Just set it up as told in the instructions. Then you can use C-x C-o to open the auto-completion popup.
To get completion of android classes just add it temporarily to your CLASSPATH environment variable e.g. by starting vim via
CLASSPATH=/opt/android-sdk/platforms/android-2.2/android.jar:$CLASSPATH vim
You might also be interested in Vim JDE a quiet good Java IDE for vim.
The issue when setting a CLASSPATH with javacomplete is that your tying yourself to a specific target platform, target '9' in buergi's example.
I wrote a small plugin that reads current target and set an appropriate CLASSPATH for current project's target on after 'java' filetype is set.
In order to use it you have to call vim from the project's main directory, or start it whenever you want and then change the working directory to project's root.
Hope it helps.
Look github for android plugins, there are a few.
I recommend this plugin: https://github.com/hsanson/vim-android, and yes I wrote it.
I am working on a custom Android library. I start off with a java project (in Eclipse) with another UI testing Android project.
In my UI testing project, I reference the library project in build path, and everything is good and I can test the library codes in the UI.
Later on, I decided I need to have the 'Gen' code (for custom styles attributes), so I try to change my library to an Android project (via Android-tools -> convert.. ), and disasters happens! After fixing up all the compile time problems, it finally 'let' me start the UI testing application, and bangs! When I try to create any objects from the library class, it said (in the Log) that Class not found.
Two questions:
Any idea how to fix this? I tried but seems it is for referencing another .apk that need to install separately.
If I just keep it to be java project (not android) for my library, can I use the resource generator? and how?
PS: the dependency (my library) is installed before the UI test application, according to the Console of Eclipse said.
Update: I tried to compile the library project to jar and reference it from the UI testing, and in this way, it works. But I don't want to use this approach since it is very slow in terms of testing.
for those who are doing same mistake like me
when library project is an android project
got to
properties > android > click add button at bottom of the popup inside
library section
and add project, instead of
properties > java build path > project > add
later approach is for pure java projects only .
Finally I found the answer to my own question. This is actually mentioned in official documentation.
I wanted to try out IntelliJ-IDEA but my experiments failed in a very early state. The Problem is that I found no way to set the Java platforms to be used.
Standard Java fails #Override annotation as IntelliJ-IDEA fails to to use the installed Java 6.
Android tells me to set the Android platform - only there is no setting so be seen to set any platform.
So what am I missing here?
Use File -> Project Structure menu.
There you can specify jdk(by New button you can add your installed jdk).
In your android module settings(Project Structure : Modules) click the detected facet( Android ) and there choose your platform.
Please refer to the official documentation. Also be aware of this issue.