Eclipse does not generate New Activity after I download the latest SDK - java

I start my first Eclipse Project but I cannot create any Activity, I already Restart my IDE and Even restarting my Computer does not help.
What I did when creating a Project:
File - > New Android Project - > Fill-up Information (min:API-8,Target and Build:Android 4.XL prev) next ---> next ---> Blank Activity ---> Fill-up Again -- > Finish
But no activity is in the SRC folder, I need to know whats wrong with my IDE or related to my problem.
I also done Updating using this CDN http://dl-ssl.google.com/android/eclipse/ but it wont work.

I got the same issue as you do and I have a working solution which is I already posted here
Eclipse doesn't create Main Activity and layout
Using this Eclipse Update http://dl-ssl.google.com/android/eclipse/ did not work for me. I notice this problem when I download the latest updated SDK
Luckily the solution to my problem is very easy.
By Selecting Empty Project instead of Blank Activity makes it working.

Related

No res folder. No activity_main.xml. No activity. No layout

I am just starting to use Android Studio.
I have followed the steps through in the Studio. I chose "Basic Activity". The app loads, but there's nothing but empty directories there and it has no activity folder or anything to edit the layout with.
I checked it in the Windows explorer, and it just looks the same as in Android studio.
I've read this, this, this, this, this, this, and other ones, and have probably spent over an hour trying to figure out how to do this.
I've also re-tried creating the project at least 5 times, but I've had no success.
Edit: Here's what the app folder looks like:
Edit: Someone told me I should just create a new activity. Being an absolute new person, I didn't know how to do that, so I looked at this post. However, the post tells me that I need to go into the "New" menu, but I don't see "Activity" in here like the post asserted it would be.
In the following menu click the arrow and select "Project" (is better):
Then go to "name of your project folder" > "app" > "src" > "main" > "res".
I have no idea if this was what was causing it, but first I uninstalled then re-installed Android studio, deleted the old project, and created a new one.
It still didn't work, BUT I just noticed a little error log button.
You see, I named my application com.con.pfq. It wasn't liking the "con" part - said it's an invalid file name.
Sooo... I recreated the app as com.connoriscool.pfqmmobile. It liked that more.
No idea what's happening here, but that's the solution.

when open an android project on eclipse i got some errors

I update my os to win 8.1.Then i installed adt bundle.When i create a project on eclipse it creates project without any activity.I mean the src file is empty and also there is no xml file like main_activity.xml.Btw i can debug my old applications that i developed on win7.
Then i update my sdk.This time it creates activities but as an actionBarActivity.I mean MainActivity extedns ActionBarActivity.Also when the project created on folder appcompatv_7 is automatically created on my workspace.Then i code something it doesnt work on my phone but i know the code is totaly true.Help me please.
I removed the adt and reinstall it.
I check the updates.Eclipse didnt found any update.
My sdk manage looks like
You can always make your own activity by going into: src > com.example.projectName. Right click this, and create a new class. Make that class extend Activity.
If you want Eclipse to make your main_activity for you, then you probably did not "check" one of the checkboxes to make a new activity along with your new android application project. To do this, please do the following:
1. File > new > android project
2. A new window should appear. Name your android application as usual, and click next.
3. This step is important. You must check the "Create Activity" checkbox. You probably did not do this the first time, which was why
you had an empty android application project.
4. Click next until you see the "Create Activity" option. You can choose from either a blank activity, Fullscreen activity, or
Master/detail flow. Click the "blank activity" in order to get a
normal activity (and when I say normal activity, I mean the
MainActivity.java and the main_activity.xml)
Also, whenever you make a new activity in a pre-existing project, be sure to carefully read all the options. Right click your package in the src folder, press new > android activity, and carefully read all the options.
I hope this helps you.

Eclipse Error: The refactoring does not change any source code

i have done one small coding in mainactivity.java and now i have to create another java in src folder in android eclipse but i am not able to do it
i want to create as shown below
so i want to create new class stackinfoactivity .
i click on the next after choosing android activity in the menu menu
i choose blank and hit next
details entered and click on next button
instead of creating a class i am getting an error i have added all the unique details is there any problem with my eclipse i need to correct my eclipse
i clicked on finish button the activity will not get created i have colored the image above
please anyone suggest me how to correct and get rid of this error
Check if you have older version of ADT plug-in.
You need to update ADT plug-in after updating SDK manager.
Not just select "Help->Check for Updates" but select "Help->Install New Software..." and select the ADT site to install newer version of ADT plug-in.
The recent version of ADT plug-in is 22.6.0.v201403010043-1049357
I had the same problem after I upgrade SDK manager and my ADT-plugin is 22.3 at that time. "Check for Updates" always tell me no update available.
You can do this also like following way.
Right click on your Package name that is com.redpot.stockquote folder of your project then select new then select class you will get window like following images. (Please follow link as i don't have enough reputation to post images here)
http://share.pho.to/4tXRY
Here in Name just enter your activity name like StockInfiActivity. And then select Finish and you will see your Activity in your src folder.

Netbeans - Error: Could not find or load main class

So I'm making a java application in Neatbeans 7.4, been working at it for a while, everything was fine, running the project worked fine, but now when I hit run project, I get the error
Error: Could not find or load main class phleveledit.MainWindow
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I can't think of what I did right before this started happening, so I don't know what I should change.. The code doesn't appear to have any errors. Here's a screenshot of the IDE+project folder
Image (http://puu.sh/5ldYB) :
Any ideas?
Edit: Unfortunately I happened to fix this problem by removing some code, which probably had some errors Netbeans couldn't detect, but I don't know what was exactly wrong so can't vote on a correct answer.
Right click on your Project in the project explorer
Click on properties
Click on Run
Make sure your Main Class is the one you want to be the entry point. (Make sure to use the fully qualified name i.e. mypackage.MyClass)
Click OK.
Clean an build your project
Run Project :)
If you just want to run the file, right click on the class from the package explorer, and click Run File, or (Alt + R, F), or (Shift + F6)
Just close the Netbeans. Go to C:\Users\YOUR_PC_NAME\AppData\Local\Netbeans and delete the Cache folder. The open the Netbeans again and run the project.
It works like magic for me.
(AppData folder might be hidden probably, if so, you need to make it appear in Folder Options).
You can :
RightClick on project node and go to Set configuration
Select the main class for your application.
Then clean and build.
Even if the above steps don't work for you then then delete the Netbeans cache by deleting the (index) folder
User\.netbeans\SOME_NUMBER_reflecting_your_version\var\cache\index\
Sometimes due to out of memory space error, NetBeans does not load or find main class.
If you have tried setting the properties and still it is not working then try
Select the project from the project explorer
Click on Run in the Menu Bar
Click on Compile
It worked for me.
This condition happens to me every 6-months or so. I think it happens when closing NetBeans under very low memory conditions. I discovered that it could be easily corrected by (1) Rename your project, including its folder name using right-click on project explorer's project name---I put a simple suffix on the original name ("_damaged"). (2) Try BUILD. If that is successful, which it is for me, give three cheers. (3) Repeat step (1) to restore the original project name. BUILD and RUN should start without trouble.
I guess that the 'rename the project and folder' process causes a special rediscovery of the applications main location.
Try to rename the package name and the class/jframe names... The clean and build the application.
Right Click on the package name
Go to Refactor
Select Rename
Give it a meaningful name, preferably all in small letters
Click on Refactor
Do the same for the class/jframe names.
Last Select Run from Menu
7.Select Clean and build main project
That should do it!!! All best
I had the same issue once. The problem was not in the code. The cause was... renaming the project folder to some other non supporting name. My project name was "MobStick" and I renamed it to "MobStick - May 26, 2014 04:00PM". Renaming it back to normal solved my problem.
I have run into this error a couple of times as well and for me the above solutions did not work. What does seem to work is going to the Project Properties, and under Compiling toggling Compile on Save.
Using NetBeans 8.1, I got the dread
Error: Could not find or load main class
from carelessly leaving an empty line in the Project Properties > Run > VM Options field. Until you click in the field, you may not see the caret flashing out of place. Remove the empty line to restore equanimity.
I just ran into this problem. I was running my source from the command line and kept getting the same error. It turns out that I needed to remove the package name from my source code and then the command line compiler was happy.
The solutions above didn't work for me so maybe this will work for someone else with a similar problem.
I had the same problem, I had the package and class named the same. I renamed the class, then clean and build. Then I set the main class in the "run" under the properties of the project. I works now.
I found the following steps useful:
Right-click on the project in the left toolbar.
Hover over the 'Set Configuration' item.
Click on 'Customize...'
Click on 'Browse...' by the 'Main Class:' item.
Select the correct class.
Click 'Select Main Class'.
Click 'OK'.
My problem was that, apparently, my package name was being listed twice. Selecting the class using the dialog changed 'aclass.MainClass' to just 'MainClass'.
Hope this helps,
-HewwoCraziness
Edit: This is expanding on Mary Martinez's answer.
You can solve it in these steps
Right-click on the project in the left toolbar.
Click on properties.
Click on Run
Click the browse button on the right side.(select your main class)
Click ok
Possible Fixes:
Fix 1
Go to project properties (right click on the folder of your project in netbeans)
On left tab where it shows the categories, click on the "Run" selection
Then click on Browse to find the Main class you use on your project
Fix 2
Go to C:\Users\name\AppData\Local\Netbeans
delete the Cache folder.
Rebuild and Run
Fix 3
Download most recent version of Netbeans
Fix 4
Download most recent version of JDK and configure Netbeans to use that
I had the same problem for 3,4 days. On my PC my Jar file snapshot would give me this error while on my laptop it would work fine, I tried all the tricks shown above and on other forums like deleting cache, selecting main project file, etc, but somehow I was sure the reason it cannot find the main class when I would execute the JAR file was may be due to classpath issue in maven configuration, and I was right and I fixed it using following steps:
Right-click on the project, and go to the properties
Inside the properties go to Actions
On the right side in Actions select "Run Project" and you will see properties below
Inside "Set Properties" make sure exec.args=classpath %classpath "package_name"
In my case, the package name was accompanied by the main class. So my main class was Login while the package name was com.mycompany.islamic_center_app1, When I checked the entry was
com.mycompany.islamic_center_app1.Login
All I did was remove ".Login" from com.mycompany.islamic_center_app1 and it was fixed, no more errors.
close netbeans.
open netbeans again.
choose new project>>java application.
click next.
deselect create main class.
now make the application
clean build run
For more reference watch this video
try this it work out for me perfectly
go to project and right click on your java file at the right corner,
go to properties,
go to run,
go to browse, and then
select Main class.
now you can run your program again.
I had the same problem and I moved the project to a location where the path had no none-english letter and that fixed the problem
if you are on window os, then try to start NetBeans via administrative mode. right click on NetBeans icon and "Run as Administrative".
If none of the above works (Setting Main class, Clean and Build, deleting the cache) and you have a Maven project, try:
mvn clean install
on the command line.
Had the same problem here. Usually Clean and Build solves much of the problem. It happened to be caused by a wrongly installed plugin.
I faced the similar issue with Netbeans 10 and JDK 1.8.
I was not able to choose the right class to launch the project
When I compile or run the project, it shows me the Class name as "initializing view, please wait ...", I could not select the class name.
The issue was resolved with the NetBeans11.3, I am able to choose the correct Class file without any other changes, and the project is launched without any issues.
I had the same issue but none of this thread's solutions worked for me. Finally, it was OneDrive that caused the issue (for once more). So, I simply moved the NetBeansProjects folder from Documents which is synced with OneDrive, to C:\Users\yourName\AppData\Local\NetBeans (selected this path as there is already a NetBeans folder) and that was it, case closed.
If you also have NetBeansProjects to a OneDrive syncing folder it is worth trying this solution, just be sure that the path you will select is not synced with OneDrive. Also, remember to close Netbeans before making the folder change and after you move the folder to the new path you need just to open Netbeans again, go to file menu/open project and select your project from the new path.

The Android emulator is not reflecting changes I have made in .xml layout file

I have re-started Eclipse, re-run the application numerous times, and saved all of my files in my application. In my .xml, I have gotten rid of a button.
The .xml is inflated in my .java file. However, when I run my application on the Android emulator, it keeps showing the button that I deleted.
reinstall the application, clean the project in eclipse.
One possibility is your emulator is not connected to the ADB (Android Debug Bridge)
To check just do:
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
adb devices
You should see
List of devices attached
emulator-5554 device
If you don't see this, manually kill the adb.exe process (DON'T kill your emulator).
Then manually run adb.exe again.
When you do adb devices you should now see your emulator. If you close/kill your emulator you may have to repeat the process again.
I would have thought that restarting Eclipse would have had the same effect anyway, but for what it's worth, always try Project -> Clean in situations like this.
Clean the project and then run.
OK - I tried all this and it did not work (but I did resolve the problem...).
My project is very simple, as I am a complete newbie and had only created a mock up of the app - a simple interface and adjusted the strings XML file. None the less, I wasted a couple of hours trying to fix this damn problem. In the end, I simply generated a new project and ported all my work over. This took 10 mins and worked perfectly.
To try to learn why this happened, I repreated the steps that seemed to have caused the problem (clearing all projects, and then building them all again) - having copied all the code fromt he original project (including the manifest). I could not break it again, so am none the wiser about what caused it.
A more complicated project might be more of a challenge, but I thought I would post in any case, as I wasted a lot of time trying all these other things without sucess.
Uninstall the application from Setting->Application->Manage Application->Select Your app->Uninstall. and then run.It will work
To detail Rasel's answer (in addition to Project...Clean) you can also go to a shell and type adb uninstall com.example.applicationname.
The problem happened to me when I imported the project using the orginal files in Eclipse. It worked after I imported the projekt into the eclipse workspace as a copy
I had the same problem in Android Studio. When I added an imageButton it was visible in preview tab of Android Studio, but not in the emulator. I tried almost every solution mentioned in Stack Overflow for similar situation, but I didn't succeed. One of answers said that you should create a new project and copy your files into it, but this solution had a huge cost for me and I didn't want to try it. Finally I renamed my layout file in the onCreateView method:
View view = inflater.inflate(R.layout.fragment_story_edition, container, false);
Then I created a new layout resource and left it empty and ran the project in order to get an error. After that error, I copied the content of my original layout file to my new made layout file, and the problem was solved.

Categories