Android project cannot find third party libraries in Eclipse [duplicate] - java

This question already has answers here:
How can I use external JARs in an Android project?
(12 answers)
Closed 8 years ago.
It seems that Eclipse cannot find the third party libraries being used by the app even though I see them all in the libs folder under the package.For example, it cannot find the Crittercism, Google Analytics or Parse libraries. The import statements below all show a red X and when I click on the prompt to fix the import links, it says I have to do it manually:
import com.crittercism.app.Crittercism;
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.MapBuilder;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
My question is, how do I force Eclipse to look in the right folder, assuming it is not looking in the right place for the libraries. This is working source code from the developer which we used to create the apk and upload it to the Google Play Store, so I assume there is no issue with the code, but more so in the way the project is configured in Eclipse.

Basic thing you can do is clean/build the project Project>Clean (Refer Image : http://i.stack.imgur.com/T9ihk.png) and check if the things fixed
Check the necessary jars are available in libs folder of you project root.
Check if the neccessary jars are properly added to buildpath. Right click your project > click on Properties (Refer Image : http://i.stack.imgur.com/A6xgq.png). If you see it highlight with red then you can remove it and follow these steps (https://stackoverflow.com/a/6859020/28557) to add your jars to buildpath.

Related

How to correctly integrate OpenNLP API in an Eclipse project?

I want to use the sentencer through the API in my Java program, which is very well documented here:
http://opennlp.apache.org/documentation/1.6.0/manual/opennlp.html#tools.sentdetect.detection.api,
and has also been described here:
How to use OpenNLP with Java?
I downloaded the apache-opennlp-1.6.0-bin.tar.gz from here: http://apache.lauf-forum.at/opennlp/opennlp-1.6.0/
But what I can't find anywhere is how to install OpenNLP such that I can import it in my Java programm. I tried to simply put the .jar in my workspace, which didn't help. I don't find any documentation on that on the OpenNLP page.
Ok, I think I figured it out myself.
I simply had to put the openNLP folder somewhere, then right-click the Project and go to
Build Path --> Configure Build Path
click the Libraries tab, click Add External JARs... and navigate to the OpenNLP jar file.
Then I could import classes, such as
import opennlp.tools.sentdetect.SentenceDetectorME;
without any problems.

How to Import Android Ad Libraries

I have:
import com.google.android.gms.ads.AdView;
As well as several others. Gradle (Android Studio) refuses to recognize them. I have read that you import a specific jar, other places I have read that you must import a specific module. How do I gain access to these libraries?
You must Import the Google Play Services library into your Eclipse workspace. Click File > Import, select Android > Existing Project into Workspace, and browse to the library project...
if you read the doc the library must be located at:
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
More info:
Setting Up Google Play Service

How to import nested java projects to eclipse [duplicate]

This question already has answers here:
Importing multiple projects into eclipse
(2 answers)
Closed 8 years ago.
I have a folder called "MyProject" and inside it I have 10 folders that each of them is a Java project (contains .classpath and .project). I don't want to import them one by one. Is there a way to import folder "MyProject" and all nested ones?
I tried import>general>Existing project into workspace but it didn't work.
Also I checked the option search for nested projects but it didn't work as well. I checked this question but that is different from mine. In my case there is no parent project.
Even though I use the Eclipse, I haven't ever tried doing what you asked. So I'm just going to redirect you to this link and hopefully it will help you: Importing multiple projects into eclipse It's basically what you tried. Worked for me. When you choose a directory, you get a view of all the available projects and you just need to have checked those you want to import.

How to import a java plugin into your eclipse workspace

I am working on a java plugin and I was wondering if anyone could help me.
I need to import a plugin that goes by the name of "LogBlock" and it has a lot of files if I compile it. So I was wondering if theres a way to import it into my eclipse workspace. (Decompile it and be able to edit it).
Sorry if this question is unclear, if you need any questions about this question answered just say so. Thanks!
The easiest and simplest way to go is to use JD-GUI. A super simple decompiler. Once decomplied there are 2 things you can do:
1 - Import the files into eclipse. This could take a LONG time depending on the files.
2 Recommended - Take the files pop them in a folder named LogBlock and then go to your root folder for eclipse. Open that, you should see all your eclipse projects there. Just drag and drop the folder named LogBlock. When you launch eclipse there will be your LogBlock Java Project. Open it up and you will see a ton of files. Organize them as you saw in JD-GUI.
If you need further help with this I could make a video and give you the link to it.
Java Decompiler will do the trick.
From there you can import those files into Eclipse by right clicking your project, and choosing import from the options menu. You shouldn't be editing a released plugin however..

import android packages cannot be resolved

My android application, built inside Eclipse, suddenly fails to build with dozens of errors. The most obvious are errors indicating that all the android imports cannot be resolved.
import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
All of these are flagged as unresolvable. I've tried removing and re-adding the JRE System Library. I've tried cleaning and rebuilding. I've tried the "Quick fix" option to "Fix Project Setup..." but that simply responds with a dialog box that say...
"No proposals have been found to fix the unresolvable reference to 'android.app.Bundle'. Click here to manually configure the build path of project 'Silent Mode Toggle."
I'm new to Android development and this one has me completely stumped.
Thanks in advance for any help you can provide.
Rich
It seems that your eclipse-workspace (or at least your Project) is broken somehow.
Have you moved your android-sdk/Project recently? If it's not an Android Project anymore, try to look at Preferences->Android for a valid android sdk-location.
If this is correct, try to open a complete new Workspace, and import your sources with File->import->Android Project from existing Source.
If this still doesn't help, make a new android Project and copy the sources manually inside your Project from outside Eclipse. Re-open Eclipse after that, and make a Project->clean
What all the others said.
Specifically, I recommend you go to Project > Properties > Java Build Path > Libraries and make sure you have exactly one copy of android.jar referenced. (Sometimes you can get two if you're importing a project.) And that its path is correct.
Sometimes you can get the system to resolve this for you by clicking a different target SDK in Project > Properties > Android, then restoring your original selection.
right click on project->properties->android->select target name as "Android 4.4.2" --click ok
since DocumentsContract is added in API level 19
I just had the same problem after accepting a Java update--scores of build errors and android import not recognized. On checking the build path in Project=>Properties, I found that the check box for Android 4.3 had somehow gotten cleared. Checking it resolved all the import errors without my even having to restart the IDE or run a project clean.
try this in eclipse: Window - Preferences - Android - SDK Location and setup SDK path
This import android packages cannot be resolved is also occurs when your using some library and that library is not in the same path where your application is there, or if you are importing the library and not coping library to the workspace
May be you are using this checking :
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
}
To resolve this you need to import android.provider.DocumentsContract class.
To resolve this issue you'll need to set the build SDK version to 19 (4.4) or higher to have API level 19 symbols available while compiling.
First, use the SDK Manager to download API 19 if you don't have it yet.
Then, configure your project to use API 19:
In Android Studio: File -> Project Structure -> General Settings -> Project SDK.
In Eclipse ADT: Project Properties -> Android -> Project Build Target
I found this answer from here
Thanks .
RightClick on the Project > Properties > Android > Fix project properties
This solved it for me. easy.
To import android packages, ADT plugin of eclipse is required, only after this you
can add it in the java build path.
Go to your eclipse market and download the Android AD extension.

Categories