Error to initialize the parse.com code in Android - java

I'm beginner with Java/Android and Parse. Today i need your help . I don't know what i'm doing wrong. Look to my picture
My .jar file is in "Lib" , but i'm receiving the red lines in my project.
Also ,how can you see in Parse.initialize seems that this is not recognized.

you should import classes
add this import statement to your codes
import com.parse.Parse;
and import every class you need
you can also import all classes
import com.parse.blablabla.....;
and if you have added .jar files you can fix imports in android studio .check this one
follow these steps
1) add parse libs to your project.
2)clean your project
3) add import statement
import com.parse.Parse;
you can see i have no error after i did those steps
this is my project no errors

Related

Android Studio import com.google.android.vending.expansion.zipfile.ZipResourceFile; does not exist

I am trying to setup the apk expansion setup. I added the SampleDownloaderActivity.java but I am getting these errors once I rebuild the project
import com.google.android.vending.expansion.zipfile.ZipResourceFile; does not exist
import com.google.android.vending.expansion.zipfile.ZipResourceFile.ZipEntryRO; does not exist
What is the alternative to correct this?
you have to include the expansion library separately as the code dependency, you can get the relevant code at location <sdk>/extras/google/google_market_apk_expansion/zip_file/

What is the correct package name for importing MigLayout?

FYI, I'm new to Java development and Netbeans!
I have downloaded the MigLayout jar files, both core and for swing, and added their path in the NetBeans 8.2 IDE under 'Tools->Libraries->Library_Classpath'.
My problem is that I'm trying to use the API MigLayout() but every package name that I've tried to import it results in the error "package 'Package_Name' does not exist"
The following package names fail at compile time:
import MigLayout;
import net.miginfocom.MigLayout;
import net.miginfocom.swing.MigLayout;
The following package names only fail at run time:
import net.miginfocom.layout.Grid;
import net.miginfocom.swing;
import net.miginfocom.miglayout;
Links to the MigLayout forum are broken, and none of the tutorials I've seen have the import statements. All I am asking for is a link to or list of the packages needed to use MigLayout.
If MigLayout is no longer supported, it would be nice to know that as well!
Of all packages you mentioned, the following are actually working:
import net.miginfocom.swing.MigLayout;
import net.miginfocom.layout.Grid;
It is not enough to set the jar files in the library configuration of NetBeans (Tools > Libraries). You also need to set it inside your project to get your classpath working.
In the projects view, locate the directory called Libraries (JDK will be located there) and right click on it, then click on Add Library and choose the library where you defined your jar files, in your case Library_Classpath.

How to add (import) java websocket library to my project?

First, sorry if question is trivial - I'm new to java world.
So, I've created new project. Then I downloaded websocket jar file here:
http://www.java2s.com/Code/Jar/j/Downloadjavawebsocket130jar.htm
After that I've created 'lib' dir, copyed jar file there, selected it, added to build path.
Basically, I was following instructions from here:
http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29
Then I copied source code into my class:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.Collection;
import org.java_websocket.WebSocket;
import org.java_websocket.WebSocketImpl;
import org.java_websocket.framing.Framedata;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;
So, first part of imports is ok...standard Java imports. But problem is second group. For every import, starting from:
import org.java_websocket.WebSocket;
I'm getting error "Import.... can not be resolved." And rest of the code that's using those classes is shooting errors because of that of course.
So, I added jar file to build path, but I still can't import classes from that library. What's missing here?
First, extract the jar from the zip file, then right click the folder you're working on in your Eclipse. Click "Build path", then click "Configure Build Path", then click on "Libraries" and on the right hand side click on "Add external Jars", and then find your extracted jar.
Download the bundle from the below repository.
MVN Repository
This should resolve your issues.

Java library import difficulty

I'm trying to compile a small test program I have written for a raspberry pi.
The program makes use of the Pi4J library to control the piface add-on board.
What I have done so far is based on the following tutorial: http://www.savagehomeautomation.com/piface
While I can get the above example program to compile within my IDE after setting up the class paths I get compile errors with the one I have made and as far as I can tell the imports are set up in the same way.
It says that each of the following packages does not exist:
import java.io.IOException;
import com.pi4j.component.switches.SwitchListener;
import com.pi4j.component.switches.SwitchState;
import com.pi4j.component.switches.SwitchStateChangeEvent;
import com.pi4j.device.piface.PiFace;
import com.pi4j.device.piface.PiFaceLed;
import com.pi4j.device.piface.PiFaceRelay;
import com.pi4j.device.piface.PiFaceSwitch;
import com.pi4j.device.piface.impl.PiFaceDevice;
import com.pi4j.wiringpi.Spi;
I'm assuming that my problem is relatively simple but I don't really understand how import statements work and it's quite vague topic to search about. I have included some file paths if that helps.
This is where my project resides:
/home/pi/JBerries/relay
and this is where the pi4j library is:
/opt/pi4j
I hope the following image provides some of the information requested, note that the class paths are already set up:
You need to set the CLASSPATH environment variable to /opt/pi4j or the jar file therein. WIthout this the compiler is unable to know where your libary is located and will give you the errors you describe.
If you're using a project in JBerries you need to configure the classpath for the project - the screenshot shows the classpath for single-file compilations only. To edit the project config right-click the root node in the project window and select properties.

how to import com.android.camera package in a java project

Hi I am writing a test using UIAutomator API , however in my java project I want to import the com.android.camera package.
However I am always getting an error that this import cannot be resolved.
I have added the android.jar in my build path and rest of the things work fine.
However I am not able to import this package.
There is no such package in android, maybe you are looking for
com.android.hardware.Camera
class ?
if so try
import com.android.hardware.Camera;
The camera class resides inside the below package so try to import below package instead of com.android.camera add the below.
import android.hardware.Camera;
import android.hardware.Camera;
try to place it after your package name
If you are using Eclipse than just press Ctrl + Shift + O Eclipse will automatically add the required libraries in your source code. If still you are getting import issue than you need to check if you are using correct API or the spelling is correct.

Categories

Resources