Error: Android source build in eclipse - android

While trying to add android source to eclipse, I am getting the following errors.
Project 'android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar'
Project 'android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar'
FYI, I have built the source successfully with full_maguro-userdebug configuration (for Galaxy Nexus) before adding this to eclipse. Since I couldn't find "create project from existing source" in Eclipse Indigo, I changed the location of the project to the root directory of the source. I refreshed the project several times with same error.
How to solve this issue?

You should go to Project -> Properties -> Java Build Path.
There open tab Libraries.
In this tab out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar should be changed to out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar by selecting javalib.jar from google-common_intermediates, pressing Edit and selecting instead android-common_intermediates.
Entry with gsf-client_intermediates javalib.jar can be simply deleted.

A more comprehensive answer at here: https://groups.google.com/forum/?fromgroups=#!topic/android-platform/XIbR8ZKe7Tw

I would not recommend using eclipse for android source. Android is not a single project and it too big for an IDE like eclipse to handle.
Use simpler plain text editors like vim, emacs to browse the code

Related

Android Studio - Android Project View is Missing

I've found some webpage but it does not guide me back to normal android project view.
http://developer.android.com/sdk/installing/studio-androidview.html
I did File => Other Settings => Default Project Structure => Default Settings => OK It make even worse, import library become not function-able.
I also had this problem (creating new project also looked similar to IntelliJ IDEA), got it fixed when I enabled some Android-related plugins.
Go to Preferences (Settings on Windows and Linux) > Plugins and enable Android Support, at a minimum.
Now you will have "Android" option in the Project View.
Try:
View -> Tool Windows -> Project OR the shortcut is alt+1.
If that's not working try:
Window -> Restore Default Layout OR the shortcut is shift+F12.
Also, check that Studio is up to date:
Help -> Check for update...
None of the above solutions worked for me so I fixed this by removing the .gradle and .idea folders from my project.
The square at the bottom left corner of android studio lets you spread the screen or it populates it with side menus.
For me, it happened when I used Kotlin KTS for Gradle files, but created a java library module for this project. After trying to reimport project I got an error:
New Gradle Sync is not supported due to containing buildSrc module
Solution:
Migrate added module to kts
Remove created by Wizard settings.gradle, if you already use settings.gradle.kts
Reimport project
File -> Close project
Android Studio: import project
Show it your current project location
Just had the problem happen to me again. I got the problem solved, but unfortunately I can't confirm the solution, now that it's fix; but I have strong suspicions on what was the cause.
In my case, the problem occurred as a result of reorganizing my project directory. My projects are stored in given directory lets call it "Projects". I renamed that fold to "ProjectsBackup" and created a new "Projects" directory. I then moved selected projects now contained in the "ProjectBackup" directory to the new "Projects" directory. After moving the first project, I used Android Studio to open that project. That's when the problem occurred. I got a message that it couldn't find the gradle-wrapper and offered me the choice to create it. The gradle-wrapper is stored in a directory call "gradle" and its stored in the "Projects" directory. I had not copied that directory over from the "ProjectsBackup" to the new "Projects" directory. At the time, I thought nothing about that since, a new one was created. After trying all the various suggestion in this problem discussion, android studio offered a notification from me to update my "android gradle" plugin. I did the update and after that the "android" view was now available for me to select. The android gradle update fixed the problem.
I unfortunately, can't tell you what changed as a result of the update, nor can I tell you how you can force Android Studio to update or reinstall the android gradle plugin. All I can tell you is that I got lucky that android studio gave me that notification to update the android gradle plugin. Things like "file/project structure" and changing the Android Gradle Plugin Version, didn't fix the problem. What I did notice, was that when I first looked at that, the drop-down list of android gradle versions was an empty list. I manually put one in "3.6.3", but it didn't help. If you run into this problems I would suggest you look at the dates of the two file in the "wrapper" directory and compare those to projects you may have that are working correctly with the android view. I wish I would have checked the date of the wrapper jar file, when it wasn't working. That's what I think might have been wrong (i.e. I got a wrapper.jar file that was incompatible with my version of android studio - unfortunately I can't prove that)
problem solve i have click this button

Red exclamation mark over the project in eclipse

I am trying to run a project but there is a red exclamation mark over the project name. When checked in Problems, its throwing an error "project is missing required library". The library is pointed to android.jar located in some path. When checked in package explorer, I found the android.jar in Android 2.3.1 folder structure of project in package explorer. The android.jar located in Android 2.3.1 folder is pointing to some other path. Is the build error occurring due to the difference in paths for android.jar files? I have imported the project.So, how should I modify the path which is shown in the problems window? I am newbie to android and so pls help me.
Thanks!!!
The easiest way to resolve this common problem is to re-associate your project with an SDK version. You do this by opening project properties, clicking on Android, select a different SDK version to that which is currently selected (if one is selected at all), click okay, and then repeat the process to switch back to the desired SDK version, if desired.
I tried Phillip's answer and it didn't work in my case. Another place to look is opening project properties and clicking on "Java Build Path" -- if your project used some external JARs, check to make sure the links haven't been broken. If they have, reimport them again and remove the missing ones.
Import your library through the option: File/ Import... / Android / Existing Android Code Into Workspace, and not by creating a New Project and referencing the other (if you did this way).
I had this same problem and solved that way. As example, there is a PDF which demonstrates how to import other projects [Look at the page 28] (The material are in Portuguese)

Unable to Debug Library Projects with ADT v14 - Source Not Found

Ever since upgrading my current projects to use the new R14 Tools in Eclipse, I'm now unable to debug any code that exists in my library projects.
When I hit a break point in my library project code, instead of Eclipse opening the original source file, it opens up the read-only copy of the source file contained within the JAR with the message "Source not found".
I've searched around for a solution to this, but have yet to come across anything. Does anybody else have any suggestions? It's quite a pain not being able to debug.
EDIT
The issue has came back and I'm no longer able to debug. I haven't changed any project settings around or anything. Very frustrating.
Tried all of the above and it did not work for me, however the workaround detailed here did.
http://code.google.com/p/android/issues/detail?id=20731
Start debugging, and run until you hit a breakpoint (and precisely get a .class file instead of the .java you would like to have)
Right click in the Debug view of the Debug perspective (for example on the call stack), and choose "Edit Source Lookup Path"
Add all your projects above "Default", via "Add..." > "Java project" > "Select All"
(I'm using ADT 15.0.2 preview from http://tools.android.com/download)
After having this issue as well and doing a little research, I came across this thread and another one that tipped me off. I was pulling my hair out already.
It turns out that the problem is with the build order of your projects (mine was anyway). Since ADT/SDK v14 changed the way library projects are referenced, the build order needs to be correct. Make sure all of the libraries your app uses are built first. I just moved the "src" and "gen" folders for each of my projects to the bottom and now it builds the library first and I am able to debug it and view the source of my library files through the main project.
In case someone doesn't know where to do this, in Eclipse, right click on your project and "Build Path" and then click "Configure Build Path". Then, on the "Order and Export" tab, move the two folders for your project to the bottom of the list below your libraries. I did this for all of my projects and the library projects.
You can also do it globally in Eclipse from Windows->Preferences->General->Workspace->Build Order and moving your library projects to the top. I think the build order defined in each project will override this though, so you may want to do it in both places to solve the issue now and for future projects.
I had the same problem in a project today. The project consists of an app which has two library dependencies. I could not see code during debugging and when using auto-completion when overriding methods Eclipse was unable to deduce proper argument names.
First of all, the problem manifested itself by showing the the 'gen' folder was used as the one that contained the source. To check whether this is the same issue go to your app project, open the Android dependencies and have a look at the properties of the your library dependencies. Location path said /libraryprojectname/gen.
If this is also your problem then go to the 'Order and Export' tab of each library project and move the 'gen' item below the 'src' item. As soon as you click OK Eclipse will work a bit and when you check the Android dependency properties the location path should say: /libraryprojectname/src. Open click the dependency and open any class inside the jar. It should show the source.
I am using ADT plugin 20.0.3 with Android SDK Tools 20.0.3 and Android SDK Platform Tools 14.
The following worked for me on Eclipse Juno:
In Project Properties/Java Build Path:
In the Projects tab, added my library projects.
In the Order and Export tab, moved my library projects to the top, and checked them
Not sure if it's relevant, but Android SDK tools is rev 20.0.3 and Android SDK platform tools is 14.
I assume you are opeining library project and there you put brakepoint.
Try this: On main project open Library Projects->[yourlibrary.jar]->[yourfile.class] from Package Explorer, and then in .class file put brakepoints.
This works for me at least :)
Sometimes this happens to me. Not sure about the reason but the way I solve is:
Remove the main project from eclipse. -- Closs Eclipse -- Delete the jar file in the library project -- Open Eclipse -- Wait for the library project to compile -- Import the main project
This problem also occurs with release 21 of ADT inside Juno. As a workaround, in the "debug" view of the debug perspective (where you see threads and method invocation traces), right click and edit source lookup path.

Cannot build library dependent project after update to ADT 14

In order to implement different versions of our UI we broke our program up into UI specific code and a common library project that has everything else. Up until yesterday when I updated to ADT 14 everything was working fine. Now I can't build. I keep getting the error "The container 'Library Projects' references non existing library 'path to the bin folder of my common project and the name of the project.jar'
I've been all over the web and tried everything I can think of to fix this to no avail. Can someone help me out? I'm basically stuck at this point.
Maybe you have the same issues I had when switching to the new ADT:
In my previous setup I had some resources split between the library and the main project. The library project would not compile error free on its own but only in combination with the main project which added the missing resources.
It doesn't work like this any more.
The library project must compile completely error free now. When it does the build process will create a <lib_project_name>.jar in the bin folder of the library project.
If the jar file is not created ( thus the build process of the library project failed for some reason - eg. because the changes in the R.java file (see http://tools.android.com/recent/buildchangesinrevision14 )) you will get the error message you described.
Also, I had to manually remove the <lib_project>_src from the project.
I've had a problem with a few different projects where I did the fixes suggested in the other answer, but they were only fixed temporarily.
Every time I reopened Eclipse or did a Clean on a project, the "Library Projects" directory would disappear, and I would have to open the project properties, remove the library, and add it again.
I solved this the hard way by creating a new project and copying everything into it.
Then I found an easy way to solve it. Right click the project, Refactor-->Rename. You can rename it back afterwards. This fixed it.
Check out the article "Changes to Library Projects in Android SDK Tools, r14" ( http://android-developers.blogspot.com/2011/10/changes-to-library-projects-in-android.html ) on the Android Developers blog.
E.g. #P.Melch: "I had to manually remove the _src from the project" should be done as follows:
To fix the project, you must remove the extraneous source folders with the following steps:
Right click source folder and choose Build Path > Remove from Build
path.
A dialog will pop up. In it, make sure to check “Also unlink the folder from the project” to completely remove the folder.
You have to update the Android SDK in Android SDK Manager
Android SDK Tools Intalled
Android SDK Plataforms Installed
Android SDK Builds Installed

error when importing android projects into eclipse

currently i have difficulties trying to import the lynda.com android app development with java essential training exercise files into eclipse. I keep getting some java errors like this.Can someone help me out with this problem?
Currently im using
Android SDK r12
ADT 12 plugin for eclipse
JDK 7x64
JRE 7x64
LEclipse IDE for Java Developers 3.7 indigo
here's the error:
The project was not built since its build path is incomplete. Cannot
find the class file for java.lang.Object. Fix the build path, then try
building this project.
The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files
(original screenshot below)
A little late on this, however after struggling with the issue myself I found a solution to the problem.
Right Click on the project --> Build Path --> Configure Build Path...
In the 'Source' tab, Select the project eg. 'myProject/src' --> Click OK.
Right Click on the project --> Android Tools --> Fix Project Properties
That should do it!
Have you tried changing your compiler to Java 5 instead of Java 7?
Also make sure that in the project settings that you're using Java 5.
Ryan,
I had the same problem and it was corrected by going to the project preferences(right click project -->preferences). Then go to "java build path" and click on the libraries tab. Look for your JRE lib in the list. In my case the system was unable to find it, but the entry was still there. Delete this and add a new one by clicking "add library" and select JRE System library. Then select the default system lib. Close out of the preferences window and then Right click on your project and go to android tools-->Fix project Properties. Clean your project and try building again.
This works
Project > Properties > Android > change the Build Target

Categories

Resources