An internal error occurred during: "Launching Project". java.lang.NullPointerException - android

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 :)

Related

Android Studio failed to launch

I am new to development am building my first app. As I am getting closer to completion of the project I will need Android Studio... I have installed but it simply fails to launch. I have searched my options on various sources.
Fixes I have already tried:
Added disable.android.first.run=true in the idea file
Did a clean installation
Installed the latest version of Java
Did all of the above again as Admin just in case
Set the JAVA_HOME and JAVA_JRE and cmd %echo% came back with the correct path
There is one thing I noticed. When deleting the Google folder in my Roaming the program runs again but once I pick "Do not import settings" then the program creates this folder but pops the error.
I would post the error message but the error window comes blank.
Thank you in advance for any and all help!

Android Studio can't find runner

I cloned a project from git and built it in android studio without any problems but I don't have (Run app) in android studio and also when I run run-android I get this error:
Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`
but I can run my emulator from AVD manager!
I did every solutions that I found with search but they didn't work for me
For me, the reason was one of the following:
Gradle sync was in progress
Gradle sync had failed
For the second case, go to your top-level or app build file and click Try again or Sync button on the notification shown at the top of the file.
You could also just try to sync the IDE with Gradle with either of these buttons:
I faced a similar error. I was trying to import a built apk to profile it and ran into the scenario where the run button was grayed out.
Ultimately what worked. I went to File > Manage IDE Settings > Restore default settings.. and redid the android studio setup.
Note: Doing this will RESET the entire Android Studio and redownload everything.
1- Give the SDK path (to find the emulator path), Usually in User\YourUsername\AppData (is hidden by default)\Local\Android\Sdk. in File->Project structure, SDK location. Also the Java\Jdk path for (JDKs) and the path "...java\util\concurrent" exist
Do not reset the IDE Settings (because you need to reinstall a lot of things and it will not solve)
2 possibility - from File->Setting->Tools->Emulator to check the Launch in a tool window
3 possibility -

Application updates in emulator from Eclipse

In Eclipse, when I modify my Android application and I launch it in the emulator, Eclipse first asks me if I want to save the modified files and I answer "yes". So far, everything seems normal.
The problem is that, in the console window, Eclipse says : "Application already deployed. No need to reinstall.". And the application is not updated in the emulator.
Any idea of a reason which could explain this behaviour?
I can add that the "Build automatically" option is set.
After some more investigations, despite the "Build automatically" option set, I'm not sure the build is executed. How can I check if a new "apk" file has been created?
The problem seems to be much bigger : when I create with the wizard a brand new Android application, in the error window, Eclipse displays the following error : "failed to load properties files for project". The resource file (R) is not generated and, in the marker window, I have one error for each line of code containing a reference to the resource file.
With a complete re-installation of both Eclipse and the Android SDK manager, the problem seems to be solved.
Try re-installing the app.
Also, always exit the app in the emulator before updating it. It should work by itself, but it can be weird sometimes.
Just uninstall the application in your emulator and red-deploy it.

Exported Eclipse Android project won't run from Android Studio

I followed googles instructions and exported a test project from Eclipse by using the
Export -> Generate Gradle build files
opened up Android Studio and imported. After getting my support libraries working properly my project would compile with out any errors. My problem started when I tried to run the app on my device. When ever I try to run the app it directs me to use an AVD, never giving me the option to select my device. I obliged, created a new AVD but to no avail only to get build failed error. (I'll add the exact error when I can) NOTE: I can see my device is connected by clicking on "(6)Android" and the bottom left of the screen. I do see all logcat messages in verbose. I added android:debuggable="true"to my manifest but still nothing.
Confused I created a new project directly from Android Studio, hit run and bingo,...it gave me the option to use my device to run it or an AVD. Selecting either results in a successful launch of the dummy "Hello World" app. I think it may have something to do with build variants as my imported project doesn't specify "debug" vs "release" while the Android Studio generated project does.
Anyone else experiencing this?
I found the answer to my own question. Bit of a double whammy. Before installing Android Studio I updated my SDK via Eclipse (as recommended/required by google). Turns out by doing so a few items in my current projects got disconnected. ie. build paths, dependencies, ect. (you now have to place external Jar's in the src/libs folder)
Here is what I did to fix it.
In Eclipse, Preferences -> Java Built Path ->"Order and Export" tab. Make sure items are selected
If you have external Jars, manually copy and paste the jar in the libs folder of the project. (I did this in my Finder)
confirm the project launches via Eclipse
If it runs, export the project again by "Generate Gradle build files" (confirm overwriting existing files, if any)
5.Open Android Studio and re-import the project. Again, confirming overwriting of any existing files.
6.Next to the run bottom at the top of the screen click on the drop down next to your project name. Click "Edit Configurations..." and select "show chooser dialog" if not already selected.
clicked ok to exit,..and PRESTO!!! I finally have a successful project migration.
Hope this saves someone else time.
Cheers!
Yeah i have experienced similar stuff on Eclipse, its quite buggy. Since Android studio is based on it i would expect everything. Still the best solution to everything is to reload project, refresh project or restart IDE.

Android: Eclipse doesn't pushed new version of app to emulator

When developing for Android in Eclipse, the emulator relaunches the old version of the app each time I run the project unless I go through the rather arduous procedure of Settings -> Applications -> Manage applications -> [my application] -> Uninstall -> Ok -> Ok in the emulator.
I had this problem on some projects but not on others when following the tutorials on the Android Developers site, and my friend turns out to have the same problem. Although this has been asked before (here and to some extent here) their problem turned out to be "some extra quotes on one of the xml file" and I can see no such thing in my project. Otherwise people seems to be saying that Eclipse should push the new version. Unfortunately, it doesn't.
I would be grateful for any suggestions.
I had this issue as well, and what i figured out was:
If you are using your device for debugging, then you should launch a debug session, not a run one.
On the other hand, if you want to install an application, or you want to launch a run session directly on your device, the version of your application set in the androidManifest.xml must be greater than the one on your phone.
Try Menu-Project-Clean, Select your project to clean, this will delete everything but the source. Eclipse should re-build automagically if not select Menu-Project-Build Automatically.
Right click your project, Android tools, fix project should automatically fix some unknown error maybe
Double check your xml, an error in a layout could cause your situation. A wrong id for example will not show as an error in eclipse.

Categories

Resources