I am trying to configure my app with Facebook and Parse. I followed all their instructions and copied/edited the sample code accordingly.
Finally, I was met with this error:
the import tags
ex.
import com.facebook.FacebookRequestError;
import com.facebook.Request;
import com.facebook.Response;
import com.facebook.Session;
etc.
were underlined red, and there were plenty of errors in the project. i clicked the little red bulb above these tags and added the facebook dependency. this got rid of most of the errors and imported the above. however, a new issue was introduced: everything in the project that has: "R.whatever" has the R underlined.
How do I fix this?
Also, if this helps, the userdetails.xml has a rendering issue saying the following:
endering Problems NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first. The following classes could not be found:
- com.facebook.widget.ProfilePictureView
EDIT
I am using Android Studio
Are you using Eclipse? The missing R errors usually are a resault of a compilation error. Try to first run the clean command on the project and compile it again, and if that doesn't help look for any errors apart from the missing R - you should be able to find one that's different and it's probably causing the problem.
Related
I am using Android Studio and getting the error, "cannot resolve symbol" when trying to import the following libraries:
import android.os.ServiceManager;
import android.os.storage.IMountService;
import android.os.storage.StorageEventListener;
Why do I get these errors? I can view the files ServieManager.java, IMountService.java, and StorageEventListener.java in Android Studio (Press Shift twice, and type in the file name - ServiceManager.java for example - and verify the file shows up. My IDE recognizes the file is there).
Looking at the attached picture below, it seems ServiceManager.java is part of the android 19 API:
None of those classes are part of the Android SDK. For example, you will not find them in the published documentation. They are part of the implementation of Android, but they are not part of the public API of Android.
As a result, Android SDK projects cannot reference them.
I am trying to install zxing in android studio but i am running into some trouble. I have looked around at lots of different posts and tutorials and they have all said to just add the following lines into the build.gradle dependencies
compile 'com.google.zxing:core:3.1.0'
compile 'com.google.zxing:android-integration:3.1.0'
I have done this and synced everything but when I try and add an import like
import com.google.zxing.integration.android.IntentResult;
at the top of my project it instantly disappears without an errors or warning.
Has anyone else had this problem or know what I am doing wrong?
Your IDE will remove the import if you have some auto-cleaning unused import statements. It depends on the IDE to configure this option but both Android Studio and Eclipse have this feature.
I suggest you to start using this IntentResult and then it will keep the import statement.
I am new to Android development so I apologize for anything I forget to clarify. I am working on a group project in Android studio, checked out from Git. I previously was able to build the project fine, but after a recent pull I suddenly have many compilation errors coming from the package
projectname\tess two\jni\com_googlecode_tesseract_android\src\java\com\google
It seems that I have a big mess of unresolved symbols, like "cannot resolve symbol (piccolo2d, Color, event, swing), which appear at import statements like these at the top of my classes underneath this project
import org.piccolo2d.*;
import java.awt.Color;
import java.awt.event.*;
import javax.swing.Timer;
I am wondering what might cause these unresolved symbols. I have tried deleting the project and re-pulling it from Git, re-building the project, etc.
Any help or direction would be great, I realize I did not give a lot of context, mostly because I myself am confused at where these problems could suddenly come from.
Anything related to awt or swing will inevitably fail; those toolkits are not available on Android. Someone or something is accidentally importing symbols from the wrong place. It's probably android.graphics.Color you want instead of java.awt.Color, etc.
I suspect that if you delete those imports, and then select Optimize Imports from the Code menu in Android Studio, the correct symbols will be imported.
i tryed to start a new android project on ubuntu 13.04 but when i'm starting my project it gives me a compillation error.
the error is with the R library ("R cannot be resolved to a variable").
when i tries to import the import android.R it just give me another error.
any one maybe know what is my problem?
You normally shouldn't manually import R. If Organize Imports (ctrl-shift-o) causes it to be added to the list of imports, that often indicates an inconsistency between the package name used in the package statement at the top of your source file and the package name used in your AndroidManifest.xml file. Make sure those two match.
I downloaded an Android Project and got some errors.
How can I use this imports in Android?
import com.android.internal.telephony.IccSmsInterfaceManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SMSDispatcher;
When I import this, I got errors like these:
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
Later in the code there are:
Phone phone = PhoneFactory.getDefaultPhone();
With the error:
Multiple markers at this line
- Phone cannot be resolved to a type
- PhoneFactory cannot be resolved
And so on...
I tried to fix it with the https://stackoverflow.com/a/16377968/3203914
but I did not work for me.
Can please someone tell me how to fix it?
Thanks!
How can I use this imports in Android?
Those are not part of the Android SDK. If you are editing the Android source code, the build process for it should resolve those imports. If you are trying to write an Android app, you cannot directly reference them. In fact, com.android suggests they are part of a separate app, not yours and not the Android framework.
CommonsWare is correct, its not in the SDK so you cannot directly reference them. You will either have to
Import all of the android source code, which will resolve these issues
Import the specific project containing this code, then set up your code as a dependency
Stop using those packages