Posts

Showing posts with the label Eclipse

Any Way (or Shortcut) To Auto Import The Classes In IntelliJ IDEA Like In Eclipse?

Image
Answer : IntelliJ IDEA does not have an action to add imports. Rather it has the ability to do such as you type. If you enable the "Add unambiguous imports on the fly" in Settings > Editor > General > Auto Import , IntelliJ IDEA will add them as you type without the need for any shortcuts. You can also add classes and packages to exclude from auto importing to make a class you use heavily, that clashes with other classes of the same name, unambiguous. For classes that are ambiguous (or is you prefer to have the "Add unambiguous imports on the fly" option turned off), just type the name of the class (just the name is OK, no need to fully qualify). Use code completion and select the particular class you want: Notice the fully qualified names to the right. When I select the one I want and hit enter, IDEA will automatically add the import statement. This works the same if I was typing the name of a constructor. For static methods, you can even just ke...

Android How To Create Intent Filter For Custom File Extension That Does NOT Make It Part Of A Chooser For Everything On The Phone

Answer : The only way to solve this problem is add scheme and host attributes to your intent filter: <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="file" /> <data android:mimeType="*/*" /> <data android:pathPattern=".*\\.tgtp" /> <data android:host="*" /> </intent-filter> That is because in documentation says that android:pathPattern only works if has an scheme and host defined. http://developer.android.com/guide/topics/manifest/data-element.html Hope it helps. I've been struggling with this quite a bit for a custom file extension, myself. After a lot of searching, I found this web page where the poster discovered that Android's patternMatcher class (which is used for the pathPattern matching in Intent-Filters) has unexpected behavior when y...

ClassLoader GetResourceAsStream Returns Null

Answer : If it's in the same package use InputStream is = Driver.class.getResourceAsStream("myconfig.txt"); The way you have it InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("myconfig.txt"); It's looking for the file in the root of the classpath. You could use InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("com/me/myapp/myconfig.txt"); The rules for searching are explained in the javadoc of ClassLoader#getResource(String) and the javadoc of Class#getResource(String) . If you are working with Maven, add the following lines under BUILD tag. You get this error when you are running the webapp on server but there is no reference to the resources on the server. So, add this the following into your POM.xml and see the magic. <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <...

Android Emulator Error: "System UI Has Stopped"

Answer : This is still "unanswered", but it probably has been resolved. I just want to share my experience and clarify a few things, some of which may not matter. Anyway, if this helps someone else that's great. 1) I had this problem on one machine (a new, but slower machine), but not another (the faster one) when running a 4.0.3 emulator. It is not a hardware problem though, and CPU speed doesn't make a difference. 2) Both machines are fully up-to-date ADT (Eclipse 4.2.x and Android 4.2.2 (API 17) SDK environments. 3) Editing, or even Deleting the emulator and then recreating it did NOT fix it. 4) The best solution is to locate and update the config.ini file. In Windows 7 (x64) I found the config.ini file in C:\Users \ [your user name] \ .android\avd\ICS_4.0.3_API_15.avd [*see AVD names below]. NOTE: First make sure you have “show hidden files, folder, or drives” turned on in Explorer or you won't see the ".android" folder. 5) Not s...

Checkstyle : Always Receive File Contains Tab Characters (this Is The First Instance)

Answer : step 1 In eclipse, Preference > Java > Code Style > Formatter. Edit the Active profile.(If you don't wish to edit the built-in profile , create a new profile). Under "Active profile:" there is a drop down dialogue box .. beside it, click "Edit..." which opens up the edit dialog box. Under the "Indention" tab, you'll find Tab Policy . Change the Tab Policy from Mixed to Space only & apply the changes. step 2 Back to your Eclipse Perspective, navigate via the menu bar: Source > Format Element (not "Format") and save. Run checkstyle you won't find "File Tab Character: File contains tab characters (this is the first instance)." warning anymore. To visualize the difference by enabling whitespace character that you'll find in tool bar. In eclipse, go to Preferences > General > Editors > Text Editors and check the box for "Insert spaces for tabs". Then it will indent ...

Building With Lombok's @Slf4j And Eclipse: Cannot Find Symbol Log

Answer : You also have to install Lombok into Eclipse. See also this answer on how to do that or check if Lombok is installed correctly. Full Disclosure: I am one of the Project Lombok developers. I got the same error even after Lombok was installed. For me the solution was to add another lombok annotation (i used @Data) to my class after which the eclipse errors went away. Perhaps this force refreshed some cache. Of course, I simply deleted the @Data annotation afterwards. I also faced the similar issue on log and @Slf4j on my STS environment. To resolve this, here is what I did on spring tool suite (sts-4.4.0.RELEASE) and lombok-1.18.10.jar (current latest version available in mavenrepository). If having maven project, ensure lombok dependency added to it. Else you need manually add the jar to your project classpath. <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifa...

Android Min SDK Version Vs. Target SDK Version

Answer : The comment posted by the OP to the question (basically stating that the targetSDK doesn't affect the compiling of an app) is entirely wrong! Sorry to be blunt. In short, here is the purpose to declaring a different targetSDK from the minSDK: It means you are using features from a higher level SDK than your minimum, but you have ensured backwards compatibility . In other words, imagine that you want to use a feature that was only recently introduced, but that isn't critical to your application. You would then set the targetSDK to the version where this new feature was introduced and the minimum to something lower so that everyone could still use your app. To give an example, let's say you're writing an app that makes extensive use of gesture detection. However, every command that can be recognised by a gesture can also be done by a button or from the menu. In this case, gestures are a 'cool extra' but aren't required. Therefore you would set ...

Adb Server Is Out Of Date. Killing... Cannot Bind 'tcp:5037' ADB Server Didn't ACK * Failed To Start Daemon * In Ubuntu 14.04 LTS

Answer : You need to set the path of your SDK's adb into Genymotion. By default, Genymotion uses its own ADB tool (for many reasons). If the both binaries are not compatible (if your Android SDK platform tools or Genymotion has not been updated for a while) this problem happens. To solve it you can define a specific one from the Android SDK. To specify a custom ADB tool: Open Genymotion > Settings > ADB. Check Use custom Android SDK tools. Specify the path to the Android SDK by clicking Browse. Click OK. update the adb to 1.0.32 if you have 1.0.31 or lower adb version Android Debug Bridge version 1.0.31 wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb sudo mv adb /usr/bin/adb sudo chmod +x /usr/bin/adb adb version Android Debug Bridge version 1.0.32 for me the problem was that I am trying to use 2 adb processes sudo apt-get remove adb android-tools-adb and...