Library path not found (google-play-services_lib) - java

Im using eclipe,
Following the EXACT guilds of developers.android.com , just doesn't work.
I just want to add the google-play-services_lib to my project, apperently eclipse is to stupid to find the path.
When i click properties > android > add project > google-play-services_lib it adds the library in the list, gives me also a green sign, everthing well.
Then i click apply, and nothing happens, nothing added to depedencies...
When i check properties > android again it tells me it didn't find the path i gave...
Though i did multiple times exactly the same with other projects, and i just could add this library!...
Whats wrong..
Ive a second library which is the facebook_sdk, but this can't be the problem right?
Please help.

Is the Google Play Services library on a different drive to the project? There is an issue if they are located on different drives which causes eclipse to not find the path.
Copy the Google Play Services library to the same drive, and reimport into eclipse and see if that works.
Otherwise try deleting the play services project in eclipse and reimporting it. Sometimes if the SDK (and play services) has been updated, eclipse needs it to be reimported.

Related

IntelliJ: Why are my libraries not being recognized/downloaded?

IntelliJ newcomer here. I'm having some issues getting my project dependencies working:
So I have a project called ClearDialogue. It's an IDE for making branching dialogue for video games. It relies on my other project, Clear (ClearVG and ClearWindows) for creating its window and also rendering the UI. ClearDialogue also depends on LWJGL3 and a few other dependencies. The projects use Maven to manage its dependencies.
Clear is a project on my machine that I've set up in IntelliJ and successfully ran its demos. ClearDialogue however is where my trouble started; it relies on Clear to work, which is another project (not a JAR thats uploaded for it to fetch). So what I'm saying is: I need to be able to use another IntelliJ project as a library in ClearDialogue.
According to other similar questions, I can achieve this by referencing the other project in the pom file of the project that's referencing it. So I did that and it actually did appear in the "External Libraries" dropdown:
.
There are a few problems:
1) Despite Clear appearing in the External Libraries section, it's still not being recognized by the IDE as a library and when I try to build the project, errors like this are printed to the console:
.
2) It seems that Clear is the only library being downloaded despite LWJGL3 and other libraries being designated as dependencies in the pom file. They aren't being downloaded and aren't appearing in the External Libraries tab. That said, Clear itself uses some of the same libraries (LWJGL3) so is it that it's just making sure they aren't duplicated? Either way, the code itself is drawing red lines because it can't find the LWJGL3 libraries.
Does anyone know ways to fix these issues? Thanks in advance.
I managed to fix both of these problems myself.
To solve the first problem of using another project as a dependency, I was able to use the maven attributes of the projects to do so. I referenced Clear in ClearDialogue's pom file like this:
.
Then I opened the Maven view (View -> Tool Windows -> Maven) and added the pom files from Clear's own modules to the list along with the needed modules within the project itself:
.
After this I pressed the "Reimport all Maven Projects" button (the button in the picture above that looks like a refresh button) and rebuilt the project (Build -> Rebuild Project). This successfully downloaded all of my needed libraries and successfully added the local libraries from my own projects only available on the machine as well. With that I was able to successfully run to program as well.
As for the second half of my problem, I was able to find this answer from another question here on Stack Overflow, which coincidentally was how I was able to figure out how to add local dependencies as well.

Stuck with first time java for android

guys, with my friend started working on a school project - developing a java app for android. He started it, now it's my turn to do my job, so i got the code he already has, set up Android SDK for Eclipse and downloaded all the neccessary files and packages, but it still gives me errors and I can't even run the project.
One of the errors (the main one, I think) is that it can't import android.support.v7.app.ActionBarActivity
If anyone knows what can I do (I've tried all kinds of solutions from the internet, but none work) I would be very grateful.
Here is a screenshot of the code
http://s17.postimg.org/8aw952lha/Capture.jpg
See if you have imported the ActionBar project to your Eclipse workspace, also, right click on your project->properties->android and check that you have referenced/linked the ActionBar project there.
If you are using a repository without the proper ignore files it is possible that you have imported your partners configurations and then have the references to the auxiliary projects broken (you just need to update that).
Hope it helps.
android.support.v7.app.ActionBarActivity is a support library. This allows older versions of Android (before native support for an action bar was available) to use the action bar.
Since you are having difficulty importing it, I'd assume you do not have the support library installed.
Full instructions are available here:
http://developer.android.com/tools/support-library/setup.html
A snippet for adding support libraries to Eclipse:
Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a libs/ directory in the root of your application project.
Copy the JAR file from your Android SDK installation directory (e.g., /extras/android/support/v4/android-support-v4.jar) into your application's project libs/ directory.
Right click the JAR file and select Build Path > Add to Build Path.

Java - Android - NoClassDefFoundError - "Could not find class" error in Logcat

First of all, I realise that similar questions have been posted a lot here. But I've been through all of the answers I can find to similar problems, and nothing has worked yet, so was wondering if someone could help me.
I'm trying to develop a simple chat app with an Android client and a server app sitting running on my laptop. This includes a regular Java "common" project that holds the class that is used to pass messages via the socket.
First I tried to reference the "common" project in the Android project, but after a bit of reading abandoned that idea.
Now I have exported the jar file for the common project, and imported it into my Android project by copying it into the "libs" folder, and then selecting Build Path > Add To Build Path. I have also gone to Properties > Java Build Path > Order and Export and checked the library and moved it to the top of the order.
I have also moved the "gen" project above the "src" one in that build order.
Android Private Libraries is also checked. Everything is checked.
When I debug as an Android Application to my Samsung S3, I see a "Could not find class error" in logcat when advancing to the Activity that contains a reference to a class in the "common" project. Stepping through to the point where a class in the "common" project is referenced then causes a ClassNotFoundException to be thrown.
If I try to put the name of the library in the Android Manifest, like:
<uses-library android:name="com.johndarv.chatproj.common" />
I get:
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Please check logcat output for more details.
Launch canceled!
Upon trying to install.
I have the following versions:
Eclipse Standard SDK 2.0.0
Android SDK 22.3
Android project is compiled with Android 4.2.2.
Any help would be much appreciated! If I can give any more info that would be useful, please ask!
The uses-library tag means that your app expects the library to be available on the system. This is to prevent installation on devices which do not have some expected third-party software installed. Consider phone manufacturer who ships his devices with some specific api.
So this is not your case. Forget about this tag this time.
And as to your problem. The jar is not exported into the apk.
Ensure in Project Settings > Java Build Path > Order and Export that the library jar is checked to be exported.
If you put a jar into /libs dir of android project it is automatically added to the build path. You do not need to do this manually (as you did). Then you can see it (this jar) under Android Libraries entry in under Project Settings > Java Build Path > Libraries. This entry is also checked as exported (by default in android project) in Order and Export tab.
Maybe your problm occurs due to the fact that the jar is actually exported twice (once manually and once as private library). Just remove manually added entry from build path. You will have it added once - but to be honest I do not expect this caused the problem. But for sure the problem is in your project settings. Maybe paste a screenshot with Java Build Path > Order and Export and Java Build Path > Libraries.
I managed to solve this by deleting the common project and then creating a new Java project with "Use execution environment" set to Java SE 1.6. And rewriting (copy-pasting) the old classes.
There must have been something wrong with my previous project, and looks like it was the Java version used to compile. I had tried to set the compliance version to 1.6 on the old project. In any case, creating a whole new 1.6 project, pasting the classes in, re-exporting, and copying into my Android project did the trick.
Thanks to everyone who tried to answer this for your help. Hope someone finds the above useful one day!

How do I fix these missing libraries?

So these are the three missing libraries, that I still didn't manage to add to my imported project. I tried a lot of things and it simply won't work. I downloaded google play services with SDK manager and google-play-services_lib isn't there, while google-play-services is there, but I need both. As for CaptureActivity and PortraitQR, I tried adding both jars from the project dexedLibs but it didn't work. I also tried downloading this but I don't know how to add it to the project (I only know how to add single jars)
EDIT: Okay so I played around a little bit and I think I'm closer to a solution now. I manually added google play services lib and capture activity and this is how libraries look like now:
The only remaining problem is that now there is a red exclamation mark next to my project and when I go to build paths there is this red error:
I tried to look for captureactivity.jar but I can't find it. Can anyoe help me out here?
you should import them with new project->Android project from existing code-> then locate your projects path and also make sure you make them library project; right click on project-> properties-> android -> scroll to bottom and check 'is library' checkbox
and the path for google play services lib is =>
\extras\google\google_play_services
you can also find sample code on there
These three are library projects. Let's say you have a project in your IDE which is called "PortraitQR". It must be open before your project, Evanturist, can see it as a library project. And it's the same story for the other two library projects. If it doesn't work, try removing them in the dialog you've shown here and adding them again.
You should not use any .jar files for this to work. You should have these three projects open in your IDE.

How to avoid "Refreshing external Folders" in Android development in Eclipse

I am having this annoying problem which takes 10-20 seconds and sometimes more every time my android project is refreshed or rebuilt.
I searched for android forums and also in stackoverflow and but solutions does not make sense. Please give me the solution or link to it.
My android project depends on two external java libs and android libs. Tell me if you need more info.
Earlier I asked this question and it solved the problem by removing 'source attachment'. But I believe it is not a good solution because I need source to be attached with jar. It helps while debugging, code browsing. If source is not attached then, your breakpoint stops there and you can't go in readable source.
Better Solution Needed. Is there a launcher option? which disables when app launched. or build options?
Instead of attaching a source folder to the .jar file, you should zip the source folder and attach the zipped file to the .jar.
See this answer for more info https://stackoverflow.com/a/9699242/637754
The reason for this is that you have attached source with your dependent jars. Just the remove the source from the class path. This how it can be done.
Right click on the project -> Select Build Path -> Configure Build Path.. -> Select Libraries
Select the Source attachment and Remove button will highlight. Press Remove and OK.
I think that should fix your issue.
this helped me so you can try too:
Go to your Workspace root/.metadata/.plugins/org.eclipse.jdt.core/ and remove .org.eclipse.jdt.core.external.folders folder
it contains .project file with links to external folders which takes too long to refresh
You can disable "Refresh on access" option in Window->Preferences->General->Workspace - it have no effect as I think, because even it's turned on you must manually refresh projects if you modify them outside of Eclipse
If anything else fails (my case), install a fresh copy of Eclipse Juno
Go to Help-Install Software, and add this repo:
https://dl-ssl.google.com/android/eclipse/
Check all options and install.
For migration reasons I was trying to install Eclipse on MAC OS Yosemite, since Android Studio is now the official IDE, it is hard to find Eclipse setups with the ADT plugin included. I tried several versions of Eclipse, and JUNO did the work.

Categories