Cannot create java class file in Android Studio - android-studio

Sorry for this dumb question but i cannot create a new java class file inside my package. Are there any limitations in the deep of packages?

Choose new -> File. Enter valid name, press enter. In the upcoming dialog choose Java Class

I had to right-click on root/app/src/main/java.

Ensure that you've opened the project directory correctly.
The Directory that you open as project should have the gradlew batch file, your project iml file etc.
For me, I was trying to open it from a parent directory above the project directory and I was seeing the same issue.

Related

Can't create Sample Data Directory - Android Studio

I"m trying to Create a sample data directory, using Android Studio, by clicking on app in the project view and then right mouse click to find the menu item New > Sample Data Directory.
It is not working.
Creating the directory via android studio doesn't always work. You may need to create the directory manually in your directory structure (at /app/sampledata/) without using Android Studio. Once you create it (e.g., via Windows Explorer) it should show up in Android Studio. See the the following answer for more information about sample data in general: How to put new placeholder resources into Android Studio project ("tools:sample" resources)?
"Unlike resources like images, fonts, etc. The sample data does not go in /res/ (they are not compiled with the app, hence. It is probably easier to filter them out by putting them in a totally separate directory). They go in /app/sampledata/, for example: /app/sampledata/image.png."
You can create a sample data directory in Android Studio itself by following the below steps:
Change the view of directory structure from Android to Project as follows
Right click app folder and select New->Directory
Finally, give a name to your directory, in your case, it should be sampledata
I have already created sampledata directory that's why it says "Directory already exists".
That's it. You have done it. Remember that Android Studio also supports loading sample data from a json file. All you have to give is fully qualified name of the key residing in the json file.
Ex- if your json file contains key name inside a Json Array student, then you have to specify it as "#sample/your_student_file.json/student/name" to use values present in key name.
Unless your issue happens to be different, this is a known issue that only affects Windows. As I've found, it has something to do with 'C:\' in the file path.
https://issuetracker.google.com/issues/124553391
As Shawn mentioned, you need to manually create the directory.
I've been unable to get the images to actually display in the previewer, which I suspect may also be caused by the file path bug.
Inside the app folder in file explorer, You can create a new folder (sample data) which will be reflected in your android studio.

Project not found in java ee file

I've downloaded a file from github(cloned it as well as downloaded it as a zip).
Here is the adress: https://github.com/bargenson/RMT .
I would like to open it to work with it and understand how the author used jsf, validation beans since I have some homework to do.
But my Netbeans (IDE 8.0.2) won't find any project in that file.
So I can't run it and debug it.
EDIT : After unzipping the file, I can't find any project to open in my IDE:
Can you guys help me understand how I can make this work?
Thanks!
The project you linked does not provide the metadata of a netbeans project¹. That means that either the original developer did use some different IDE (or no IDE at all) or that he did not choose to include said metadata into the repository.
You should be able to create a new free-form project from the build.xml within the project directory (after extracting the archive you downloaded). If you only wish to run specific code, you can also directly build the project from shell using ant.
¹ NetBeans uses a nbproject folder within each project's directory to track NetBeans-specific information, such as the mapping of the IDE's run and debug button to actual features of the project.
Try to unzip it. That should work.
For anyone having the same issue, I've finally found out that you can run this kind of project by creating a new project "with existing sources".
It worked perfectyl :)

Android Studio: I accidentally deleted my app.iml file from my project, how do I add it

Now, my project will not run...it is telling me that my app module is missing. Has anyone had this problem before? I have no idea what information was in that file, so I dont know what to do. Any recommendations would be appreciated :-)
I opened the "Gradle projects" pane on the right, alt-clicked the project, then "refresh Gradle project" and all was fixed.
Got it....I just imported the project like it didnt already exist and it fixed itself.
This might help too if you have not save the project.
Just copy and paste app.iml file from any project inside app folder of your project(if you already have saved the project then copy from that) and then restart the project.
This will help, msg me if problem occurs.
For me, I tried just before on my new system with fresh Android Studio install. So I have tried in some different way and worked.
I have copied app.imp file from some other project and added in app folder of the Project. After this I have followed like File -> Invalidate Caches / Restart. It refreshed the file automatically as per the gradle file details and project Run perfectly.
One of the simplest solution I found is that, if your project is synced with git repo (push to git if it is not) then simply delete it from the local system & re-clone it. After reimporting, it will work like a charm

HowTo create InstallShield MSI with no files needed locally?

Hello everyone and good day!
Question: I had create a Basic InstallShield Project in my MSVC2010, added some files and primary outputs and press build. Project compiled normally: there was created MSI, setup.exe, setup.ini and (WTF?!) local directory structure of files, which I'm trying to install (for example, "Program Files\My Company\app.exe, ..." files was copied there). I throught that this is not needed folder, so copied my setup files (MSI, setup.exe, setup.ini) to another folder and start installation. When process of installation come on to copy state, installer gave me the error, that no required files (app.exe,...) was found.
Does anybody solve this problem? I think this is the simple one.
Thanks!
You can achieve this by making some changes to the properties in solution explorer. This is so simple as you can compress all in single .exe file. Follow the given below step:
Right Click On Entire solution and Choose Properties as given below
Second step as you can see the dialog box. click on configuration Properties
Third Step
Last step
This is finest and easiest way to achieve the required task.
Answer was found by myself, but thank you all any way...
To create a self-extracted install file you need to open "Releases" tab in your InstallShield Basic project and right click on configuration click "Release WIzard...".
All what I need is at this figure:
Select Compressed from Compression option in properties view.
Simple use the "single image" build. Not cd nor dvd

J2me -Polish ---Problem related to create and build the project

I am beginner of j2me-polish.I had installed j2me-polish2.1.4.As per the steps shown in below link:-
http://www.j2mepolish.org/cms/leftsection/documentation/installation/ide-integration/netbeans/installation.html
After installing it,I tried to create project by following the step in below link:-
http://www.j2mepolish.org/cms/leftsection/documentation/installation/ide-integration/netbeans/creating-projects.html
But i am unable to create the project.it is showing me reference problem.And wen i tried to solve that problem my adding the emulator of nokia N97 then it not happening properly.
I can't able to build the program.Please help me out.
Please can u help me the for the proper steps related to creating the project and selection the option.
Thanxs a lot in advance
I follow the following steps and it works for me all the time. Download J2ME-Polish2.1.4, install the library and also Netbeans plugin. Perhaps you will need to restart the IDE. Now,
Create a project (for example Polish Table) in Netbeans, making use of J2ME polish plugin. Let's call it
Copy all files except nbproject directory in /samples/tableitem/ to NetBeans directory. Override build.xml created by Netbeans during this copying process.
Copy contents of /samples/tableitem/nbproject (except private folder) to directory. Override all the files.
Switch to NetBeans directory
Edit project.xml file. Comment out tag. Rename project name in tag to the project name created in Netbeans (i.e. Polish Table )
Edit project.properties file in nbproject directory. Change src.dir from src to source/src
Edit project.properties file in nbproject directory. Make sure that libs.classpath= property points to J2ME polish import client library. If not found, make sure that the following two lines are added:
file.reference.enough-j2mepolish-client.jar=C:/J2ME-Polish/import/enough-j2mepolish-client.jar
9.libs.classpath=${file.reference.enough-j2mepolish-client.jar}
Restart NetBeans IDE. From now on you can work completely using IDE. However you will need to compile from command line. Even this could be integrated - but didn't bother to figure out.
Hopefully this should be sufficient to get you started.

Resources