I have a problem when launching a project from Eclipse in my Android Virtual Device.
I have multiple projects in Eclipse and when I run one of them by pressing right click on a project -> Run As -> Android Application it always run the samen project. (The first project I made in Eclipse)
Does somebody knows how I can fix this?
click in the folder on the project that you want to run, then click run.
Check If you have changed your manifest.xml accordingly. It once happened with me because i copied code from one manifest to the other.
set the path properly for the default activity
Related
Please see the attached image for the project structure. Currently its the run button is greyed out. I know that I can from files open only the folder from where the android studio project starts but then version control will not work.
Right click on the MainActivity (or what ever name you use for your launching activity) and say Run. It will automatically setup the run configuration for you in Android Studio.
I have been studying Android on Eclipse Mars for some time and i have been facing a constant problem everyday-the changes made in a folder/file are not recognized by some other folder/file. For example, if i create a new layout in the layout folder and then use it in the setContentView, it shows me an error ("layout-name cannot be resolved or is not a field). It works if i save the project,close it, and open it again, but this takes up a lot of time if i have more than one error, so the question-is there a way to save and refresh the project (without having to close it) so that the newly made files and folders are recognized by the java files?
Thank you.
You can refresh your project in Eclipse by right clicking on the project root folder in your Project Explorer and selecting "Refresh".
You may also want to consider checking if you have "auto build project" turned on. In your top toolbar go to Project -> Build Automatically.
If build automatically is turned off you will have to manually build your project, by Right Clicking on the project in your Project Explorer and selecting "Build Project".
However, I do agree with Pankaj Nimgade that Android Studio is likely a better entry point IDE for Android development.
Real advice: Switch to Android Studio as soon as you can. There you would sometimes have another problem called "sync" though. But it's a much better IDE and you are at least in line with Google.
on Eclipse, F5 should do the trick. Or right click your project and Refresh. Or Clean all projects. If you are still stuck, simply close Eclipse and run it again.
My android project was compiling well but suddenly it stopped launching. Then I tried to launch other projects from Project Explorer and all project threw same exception:
An internal error occurred during: "Launching Project". java.lang.NullPointerException
But console always shows everything is normal.
Android Launch!
adb is running normally.
Performing com.mmcolrev.LoginActivity activity launch
Here's screenshot of error.
If anyone face this problem, first keep in mind that error is not in your code but due to some internal issue in eclipse ADT. I don't know exact problem but luckily found way to solve it. If you ever encounter this error follow steps below:
Exit Eclipse.
Go to Android workspace.
Locate .metadata folder(make sure you set hidden folder visibility on).
Delete .metedata folder.
Start Eclipse(you will notice project explorer is empty, don't panic) and import all your projects.
Removing Gen/R.java and restarting eclipse, worked for me.
This is a cause of AVD is not picked because you might delete it or it is not picked up correctly ... in other words deployment target is not specified or it has some problem in picking up a device.
To Resolve this:
Right click your project and choose "Properties"
From "Run/Debug" Settings, Highlight over your application name then hit "Edit..."
In "Target" tab, you have to choose a virtual device to be picked automatically under option named "Automatically pick compatible device..."
to avoid such prompt you could choose the first option "Always prompt to pick device" that will ask you everytime to choose or pick a device inside which you want to run your app.
If it still not working restart Eclipse
One cause of this issue for me was that I had been updating my Android Tools with the installer. It was running in the background doing all its updates. I had forgotten about it since I had told it to do the work in the background. Then realized it had finished its work and needed a restart after the installation.
Once the upgrade / installation was done and the IDE was restarted, the Eclipse environment went back to behaving as normal.
I had the same issue.
Non of my project in the workspace would run and I would get the same message "An internal error occurred..." and details would just say something about a Nullpointer. This happend after I did some updates and all projects in the workspace started giving the same issue.
It took me some time to find the problem:
When I go to configuration of the project (Run Configuration...) I could see that "Project" in the configuration settings was empty. So my update removed the projects from the configurations. Once I put back the project in the configuration again problem was gone.
In my case, it was because I was running it with Debug As -> Android Native Application, while the emulator was closed (I debugging on the emulator, not on a real phone).
I needed to first start the emulator using Debug As -> Android Application, after which Debug As -> Android Native Application will work.
Close the emulator and the error re-appears. My conclusion is that Debug As -> Android Native Application won't work unless the emulator is already started.
I had this error with an NDK project (eclipse mars, loaded an ant project) everytime i tried to lauch on the device (google tango yellowstone) using Debug As -> Android Native Application. Note, that i switched the device and changed a dependent library since the last successful build.
When i tried Debug As -> Android Application i got this message:
Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data!
Do you want to uninstall?
clicking OK here solved the issue, so Debug As -> Android Native Application also worked again.
I had the same issue all of a sudden. This only happened when I ran in Debug mode, and for me what fixed it was... Run -> Remove All Breakpoints. Then I could add them back, and it ran in debug mode fine.
To resolve this issue, I just remove the old JRE System Library and point to the new JRE System Library.
Got the similar issue after update the project able to procced.
Right click on the project -->Maven --> Update Project
In My case issue was java version in updating it to correct (11->1,8) and doing maven update helped me
ISSUE : Error: Could not find or load main class com.pluralsight.fundamentals.FundamentalsApplication
Caused by: java.lang.ClassNotFoundException: com.pluralsight.fundamentals.FundamentalsApplication
ANSWER:
Open cmd (Command prompt)
Check java version (java -version)
Open POM.xml and check java version there
You are getting this error, that means java version is mismatched.
Change the java version in POM.xml (example: if java 11 , add it as 1.11 in pom.xml file)
Example: <java.version>1.11</java.version>
Update Maven by right click on the on the project in eclipse
Now it will work and the error will be vanished :)
I'm not able to create a new android project in eclipse.
Whenever I try to create one & reach last screen of the wizard & hit finish button, a empty project (just folder structure) project with the same name gets created in navigator window but the wizard does not go away.
It still has that finish button & nothing happens on clicking it again.
The project created in navigator should have at-least few files for me to start working on it.
Any help?
I'm using eclipse indigo on ubuntu 12.04
try to Use Following Suggestion i'm Not Sure But Might Help you.
1 ) Just go with default launcher image (blue smiley) instead of customizing it and it should work.
2) If you have installed support library>8 Still get the error msg
-->Delete the support library from the SDK manager
-->Create a new project & install the support library by clicking on "Install / Upgrade"
also Check this answer for More Information.
Hope it will Some How Help you.
This might happen due to improper instalation..Can you specify what the message/error, it showing when you click finish on your project creation..?
else try to install eclipse again in someother location..
Installation steps-click here
Fwiw, I had this problem and I ended up reinstalling eclipse and the sdk, but I instead of installing them separately, I installed bundle:
http://developer.android.com/sdk/installing/bundle.html
and I don't get have this problem anymore.
I am trying to open an unzipped Android Project using Eclipse but every time I try to run or debug it show this error: "selection cannot be launched and there are no recent launches".
So I looked it up and tried creating a new project from an existing source but opens with errors and I open the src etc folders. I also tried importing the project which didn't work either. There are no run as options and changing the run configuration didn't really help. I couldn't find any option to open it as an Android project.
Could you please help me to run this project.
(Since I unzipped this project there is a _MACOSX folder when I import and I am not sure if that matters or should I remove that folder.)
I am running Eclipse Juno SR 2
I had a similar problem. To fix the issue go to Run-> Run Configurations...
If there isn't create a new run configuration (top left)
Under Android tab: browse and select the project you want to run
Under Target tab: select Always prompt to pick device (or) you can pick automatic launch.
Similar solution can be applied to the Debug by going to Run-> Debug Configurations...
Update:
I realize this is beyond the scope of the question but if any new developers are coming to answer then I would suggest switching to Android Studio from Eclipse. AS is the official Google supported IDE for Android development and much nicer to use.
In the Package Explorer (the left column), right-click on the name of the project (the top item). In the menu that appears, select "Run as"; then choose "Android Application".
I fixed it for Version: Luna SR2 (4.4.2)
select run configurations from right side dropdown of run button.
double click on android application.
get changing window, select your project name by browsing button of "android" tap(there are 3 tabs).
from "target" tab select ADT or your device, in which you want to run.
then press "run" at right -bottom button, left-side of "cancel".
after few moment, you will get new windows. from there you can select your connected device or ADT.
If this file is and .apk, you should install it on emulator using following command:
adb install /path/myfile.apk
For more informations, you can chek following link: http://developer.android.com/guide/developing/tools/adb.html#move
Generally this error comes in eclipse IDE when you don't have a main() function in your code.
Check whether your program has public static void main(String [] args) in it or not.
I'm using a mac and this answer is for Kotlin inside Eclipse
I installed Kotlin from Eclipse MarketPlace, clicked the perspective tab , opened Kotlin, created a new Kotlin project named FirstProject and then clicked src and created a Kotlin file named FirstFile (it had the .kt extension) and typed in
func main(args : Array<String>) {
println("Helooooooo")
}
I pressed the green Run button but kept getting this screen.
To fix it, follow these steps:
Right next to that green run button is a drop down arrow, press it then choose Run Configurations
On the left side of the accompanying screen click Kotlin Script Launch Configuration and in the drop down click New_configuration then select Run
After the screen disappeared when I pressed the Run button again I got the same exact "This selection cannot be launched ..." screen. I deleted the project FirstProject and created another one SecondProject > src > Kotlin file > named it SecondFile, typed in the println("Heloooooooo") code and a screen popped up
I choose OK and the project ran fine.
For steps 1 & 2 I also did the same thing and choose Gradle (you can see it the picture) but I don't think that made any difference.