(Noob alert!)
I want to add an SQLite component to a simple (one Java source file) app and would like to put it in a separate file. I was hoping to find something that would let me click a couple check boxes and creae the file using a template with the standard overrides and class declarations (e.g. ... MyClass extends SQLiteOpenHelper {...} and so on. Instead I can't even figure out how to add an empty .java file to the project. Google's Android Studio Tips 'n Tricks suggest navigating to the 'appropriate directory in the Project pane' and hit N. That gets me a dialogue that rejects my class name and seems to open a header file if I enter the name if the class I wish to extend (and without apparently adding anything to my project.)
I do not even see a way to add an existing file to the project. OK... I now see that if I create the .java file in the app directory (along side the MainActivity.java file) that Android Studio automatically includes it.
Is this Standard Operating Procedure? It leaves me feeling like I'm not leveraging the capabilities that Android Studio provides.
I'm using AS 0.5.2, openJDK 1.7.0
Thanks!`
If you're creating a new Java class from the Project pane, you don't need to add the ".java" to the name; you're specifying the name of the Java class, not the source file. It will figure out the filename automatically.
Related
I am trying to import GSON into my project using gradle in android studio. I have used instructions found on google'sGitHub and several stack overflow pages, such as here. However when I go to import into my file using the line
import com.google.gson.Gson;
I still get the following error
Error:(5, 23) error: package com.google.gson does not exist
example from my app's build.gradle
compile 'com.google.code.gson:gson:2.7'
and my settings.gradle
include 'gson:2.7'
Am I missing something?
Open your project. Go to File -> Project Structure...
Click on app in the Modules section and switch to the Dependencies tab. Click on the plus icon in the top right corner and select Library dependency. Select the entry for the GSON library from the list and hit OK twice. (Note: the search bar didn't work for me)
Then you are able to use the library just like you described in your question:
import com.google.gson.Gson;
Note that after adding the library your project will do a gradle sync which may take a couple of minutes.
The dependency should be imported properly after syncing your project.
Try selecting Sync Project with Gradle Files in the upper right corner of Android Studio (referring to the default layout of Bumblebee).
I have been working to find out this problem however with no success. I have a project that uses primefaces and .xhtmls, .javas etc. I am using Weblogic server in Intellij IDEA. I am trying to see changes from my browser when I change the .xhtml file and use "update classes and resources". However, I am not successful for that. By the way, this works when I changed the .java file. For .xhtml file there is no success.
PS: I use exploded artifact for that.
PS2: When I use "Update classes and resources" button, I see that ear is updated from windows explorer.
PS3: I used On 'Update' action with 'Update classes and resources' option, I used On frame deactivation with 'Update classes and resources' option and with different options, but no, nothing, no success.
I have similar setup and this works for me:
Deploying an exploded artifact;
Exploded artifact should be build on make (Ctrl+F9) - go to File > Project Structure > Artifacts and check "Build on make";
Build/make with IDE compiler (e.g not with maven) in order the IDE to understand that there is a changed file and to replace it.
The above is enough to update the xhtmls on every build/make of the project (Ctrl+F9), I do not use "Update classes and resources" neither manually nor automatically (e.g on frame deactivation)
To update resources on your server you need to press (Ctrl+F10).
For me the trick was to check "Unpack nested archives" of the .ear in the File->Project Structure:
I'm trying to integrate Google Calendar API into my android project and I follow the tutorial here
https://developers.google.com/google-apps/calendar/quickstart/android
At step 5 create a new java class
I right click project folder src>main>java>com>example>utarapp and then new>file and entered the file name but then it has this error
What's going on ?
I'm using android studio 1.3.1
I think you are trying to create file with same name which is already present in the same package. This may be one possible reason.
It seems like you are right-clicking on the upper level in your application's directory tree.
Right click on one of the files inside the utarapp folder and then select Java class option from the menu.
For me this was happenning because of the length of the class name. In my case it was "ChallengesFragmentPagerAdapter"!
Changing it to "ChallengesPagerAdapter" solved the problem.
Create a blank Activity then remove "extends Activity" from the activity class.
I'm working on a new type of navigation window. This new window (which I've called MultiNav) is intended to allow the user navigate through video, music and images in the same window, this window has three controls that allow the user to select to content type he wants to navigate.
Everything compiles, but I'm not able to link. The reason is the project is not able to find the object code (*.o files) since I've not include my changes into the build process (./configure make).
I can tell the project is autotools generated, but I can't find any of the files configure.ac or Makefile.am.
Questions:
1 - How can I include my code into Kodi/XBMC code distribution?
2 - Which are the files I've to edit to achive this?
I managed to findout how to notify xbmc/kodi project about new windows code.
In the folder xbmc/windows there is a file called Makefile.in that's the file that has to be edited in order to add your new code (for a window).
When the whole application is compiled, the code in this folder will be compiled into a static library called windows.a. Which will be linked to the main application binary.
Using the debugger in Netbeans 6.1, I'd like to step into a method of the JSF library (specifically method saveSerializedView of class StateManager), but I cannot figure out how to specify through the IDE the location of the source code for the JSF library. I'm even having trouble determining which jar file or files Netbeans is using for JSF.
This answer applies to Netbeans 6.1 circa September 2008:
It sounds as if you need to explore the "Libraries" dialog. Select "Tools" from the menu bar and "Libraries" from the menu. If you select "JSF" on the left, you'll see an association of jar files, sources (currently none in my Netbeans 6.1) and javadoc (which shows javaee5-doc-api.zip in my Netbeans).
What you need to do is add a new zip or jar of source files under the "Sources" tag.
An example of a fully populated library is the "Swing Layout Extensions" which has a jar file, sources and javadoc.
I take it your jars don't include the source, since you can't "step into."
In cases like these what I do is find the appropriate source (just StateManager.java in this case, if it's available, or jars that include source), taking care that it is the version I'm using. Inside my project tree, I create the package hierarchy to that specific class, and put that source in there. Even if the class exists in a jar, I can use this source to set breakpoints, etc.
Example for Netbeans7 and Mojarra 2.0.3
Create a new library(Tools->Libraries), call it for example Mojarra-2.0.3.
In the classpath tab add the 2 mojarra jars:
jsf-api.jar
jsf-impl.jar
In the sources tab, add two paths:
..\mojarra-2.0.3-FCS-source\jsf-api\src\main\java\
..\mojarra-2.0.3-FCS-source\jsf-ri\src\main\java\
Add the new created library to the project
download the jsf source and point to the working folder for source lookup..
It will dig into the code