Android Studio: Language Defaults are applied instead of Java scheme - java

I've downloaded a couple of schemes for Android Studio. However, after applying the scheme the Java scheme is not used even though my files are *.java and Android Studio draws a little (J) on the icon. The "Language defaults" are used instead which don't provide enough highlighting.
How can I force Android Studio to use the Java scheme? The default scheme doesn't have too many colours, so it's hard to differentiate.
Edit: The project was exported from Eclipse and imported to Android Studio.

I just found the solution myself. The src directory wasn't recognized as Sources Root. After I did that the editor magically applied the Java scheme, yay!

Related

How to set up VSCode Flutter project to correctly resolve Java code in the Android folder?

VSCode as of version 1.30.1 with Flutter extension v2.22.1 doesn't set up the Java classpaths for the android folder so working with MainActivity is a pain, and I'm kind of afraid to touch things because as soon as I start I break Flutter's build systems and then things break there. Does anyone know how to set up VSCode to work as expected with both Flutter & Android code?
The Flutter extension for VS Code only supports editing Dart code for Flutter, it does not add any support for Java.
There's some discussion about this here:
https://github.com/flutter/flutter/issues/25369
It may be possible to get working, but since it's not an official supported setup I'm unsure how easy or how well it'd work.
FWIW, if you right-click on the android folder in VS Code, there should be an option to Open in Android Studio which might at least make it quicker to jump into modifying there :-)

Can I edit xml/java codes of my android app on Brackets Editor?

I am new to Android app development. I have a source code and would like to modify some xml/java codes. Can I use the Brackets editor for this? I don't want to use Android studio as it's a bit complicated for me.
If you really want to, you can edit source files in an editor of your choosing and build the app manually via terminal. Actually, this is how it's done on Continuous Integration systems.
Typically Android projects are using Gradle build system, and come with Gradle wrappers. After you are done editing, you can just invoke it to assemble the release APK signed with proper keys as discussed in How to create a release signed apk file using Gradle? thread. Note that it would require you having downloaded Android SDK and configured your paths properly, which would be tricky for a beginner, yet completely automated in a proper IDE.
If you are unlucky, it could be an old Eclipse project, or using some less popular build system, like Ant.
As you are new to Android development, I think you should go the more simple route and just download Android Studio and import your project.

Android Studio - How does a library project used in an app follow with the app-release.apk

I'm using a library (https://github.com/PhilJay/MPAndroidChart) for plotting data in an android app. When app-release.apk is created by the program it is ready to be installed on the tablet I use for testing.
What is puzzling to me is how the parts of the library, which i use, follow with the release. In other scenarios, for example in Visual Studio and c# - program being installed on Window machine, libraries require dll files to be installed and registered on each targeted machine. In my scenario the library is written specifically for Android, but if I somehow managed to include a c++ or a c# library in my Android app using tools like libstdc++ or MONO, would it work the same way when it comes down to app-realease.apk?
Are all classes in a library included in the app-release.apk or just the parts that I use?
Thanks in advance and please let me know if the question is unclear before downvoting it!
Normally, when you build your APK, all the libs you have imported (jars) are included and transformed to dex files, as the rest of your code. So, yes all the classes are included, even if you don't use them.
You can use Proguard to remove them from the APK. Look at this post :
Use Proguard for stripping unused Support lib classes

Android Studio and Eclipse

All the people that I work with use Eclipse for creating android apps. However, I recently found out that Android is no longer supporting Eclipse and they are moving to Android Studio. All that apps that I am working on have been complied and created with Eclipse.
I'm thinking if the code and the programming language is the same, then the compiler or the IDE shouldn't matter. Would we be able to still work together and share code if I switched to Android Studio and they stayed in Eclipse? What are some of the potential problems?
No, the two IDEs use different project structures, but Android Studio has a very nice wizard that allows you to move your Eclipse project to AS. I really recommend you and your team to move to AS.
As already stated, everybody would have to make the switch to Android Studio at the same time, and you would need to make some changes to the build system.
Until everyone makes the switch, you should just use the Eclipse/ADT bundle.
You can technically keep the same old folder structure for source files when porting a project to Android Studio (we tried it, it works), but the different build system is the main change that throws a wrench into the works.
Eclipse uses the ANT build system for Android projects.
Android Studio uses the Gradle build system.
We are in the process of planning a switch at my work, and everybody will need to switch at the same time, and the build system will have to be ported from ANT over to Gradle.
See more about Gradle: http://tools.android.com/tech-docs/new-build-system/user-guide
Migrating old projects to Android Studio: http://developer.android.com/sdk/installing/migrate.html
*edited for clarity regarding folder structure

How can I develop for Android in Emacs?

I have gone through the Android guide for other IDEs, and I've got the basic build and install working fine using ant and a simple Emacs compile command. I'm aware of some of the existing tools for developing Java and XML in Emacs. I've also seen the EmacsWiki page recommending two Emacs packages, EmDroid and android-mode
I'd like to hear what people recommend, in terms of Emacs packages, small functions, or just workflows.
As a side note, I have decent familiarity with Eclipse, and I did setup the ADT plugin. However, emacs is my primary editor, and I'd like to see how I can use it here.
I too use Emacs for my Android development.
Although I do not use any Emacs packages for it.
Simply write in Emacs and then from a terminal use the android-sdk (ant, android, keytool, jarsigner, adb).
You can always use M-x compile from within Emacs, but I usually prefer a plain old bash shell for Android.
Sorry my work flow isn't really exciting.
Currently android-mode.el is in better shape, plus you can easily fork it to add your own submissions to the developers over Github.
Both of the modes are pretty basic however, and just give you a set of functions to call the various Android development tools.
You are probably aware of jde and ant-mode.el - if you're not, I've just mentioned them.
They'll help you with the general Java / Ant support you'll need for Android SDK development.
You can try Android-emacs-toolkit. http://code.google.com/p/android-emacs-toolkit/
Android-emacs-toolkit helps to build android development environment on emacs. It contains a emacs major mode which help to develop android sdk and ndk program.
It provides support for create new avd, launch avd, create new android project, build and rebuild Android sdk project, build and rebuild Android ndk project, install and uninstall apk, run executable ndk project, output emulator log on emacs.
This toolkit tested on WindowsXP/7, Ubuntu11 with android-sdk and android-ndk-r7.
For building Android itself (ie. AOSP, CyanogenMod...), look in the $(TOP)/development/ide/emacs directory. ATM, you'll find android-common.el, android-compile.el and android-host.el.
These can be used to make modules/packages inside Emacs, replacing commands like mm and mmp.

Categories

Resources