In my project I need to use IContentService, and I've used the right import (import android.content.IContentService) and yet android studio tells me 'Cannot resolve symbol IContentService'.
I know IContentService is an actual class, because it is used in ContentResolver.getContentService();
Anyone know how I can get this import to work?
You cannot use this class directly.
You can see in the source code (e.g. here for Marshmallow) that this class is tagged with the #hide annotation.
The class can only be used by reflection as shown here (with all it's disadvantages).
BTW: ContentResolver.getContentService() is also a hidden method (see here).
Related
I want to define my class on frameworks/base/core, and use it as common library.
So what I did was adding a java class file 'MyTime.java' on frameworks/base/core/java/android/text/format folder. However, when I try to import the class, error 'cannot find symbol' occurred.
The code of MyTime class is like below.
package android.text.format;
...
public class MyTime {
...
}
I can't use this class, and tried for days, but still have not found the solution.
Could anyone help me?
This sounds like a bad idea, you are creating a fork of the Android API.
Did you run
make update-api
make sdk
to update frameworks/base/api/*.txt and rebuild framework.jar? If not, it will not be visible to users.
Repeating 1. Please add to a separate library, not the base framework.
I'm using AndroidAnnotations in an Android Studio gradle project. I currently get error output from AA during compilation that says:
cannot find symbol class MyActivity_
The error output does not prevent building the application - its not really a compile error because the class is there, it seems that it is just an unfortunate timing issue with the compilation process.
Is there anything I can do to avoid these false-positive errors from AA? When there are "fake" errors shown every time I compile, its very easy to miss the real errors.
I had same error. To solve it I have revert my last changes and it has worked again.
I think it was either wrong optimized import(you must import generated classes eg. xxx_) or I injected layout by id what was not existed in the layout xml
Update
I figured it. My problem was what I had use private mofidier instead of proteced in
#ViewById(R.id.list)
private ListView list;
Try to see if you missed to fix some errors in the class MainActivity or in someone of his Bean member that you have annoted.
The problem doesn't have to be in MainActivty, but it is probably because of a private modifier which is used with Android Anotations (in injection, method declaration etc) somewhere in your code
According to the android developer page for the developer preview of L, it's possible to use the Outline class & define outlines for view's to display the shadows in the correct way.
(http://developer.android.com/preview/material/views-shadows.html#shadows)
In my case, the "L"-sdk I use, didn't found it. Therefore I couldn't import and use the class.
According to the test project, stored in sdk/samples/android-L/ui/views/Elevation/ElevationDrag this class should be stored in "android.graphics.outline", but even in this project it can't be located correctly.
Is this feature not implemented in the developer preview yet or did I missed something?
Finally got it.
It's a bug in android studio. I just added manually the import to my activity:
import android.graphics.Outline
It will be shown as error, but it can compile & run.
I hope they will fix this soon.
EDIT: I created an issue here: https://code.google.com/p/android/issues/detail?id=72788&q=android%20studio%20android%20l&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
It looks like, they're working on it.
The same problem than you but your answer it didn't work for me, I am trying to import
import android.graphics.outline;
And de output is:
Error:(7, 24) error: cannot find symbol class outline
The build.gradleseems to be well configurated with the
compileSdkVersion 'android-L'
sentence
** Fixed
the right import is: import android.graphics.Outline;
The method getWsUrl() is undefined for the type Configuration
for this line
AndroidHttpTransport _ht = new
AndroidHttpTransport(Configuration.getWsUrl());
how can ı solve it?
You probably imported the wrong Configuration. Right now, your import likely points to android.content.res.Configuration.
However, your code snippet suggests you're using (parts of) some Google Code project, androidzon. It has a webservice package that includes a Configuration class with the method you're looking for. It appears to mean something like 'get webservice url'. You will want to correct your import and/or add the missing classes/libraries to your Android project.
Do note that you appear to be using old code, as the latest revision of that Configuration class does not include the getWsUrl() anymore. In stead, there is a getServerAddress() method.
In an android Activity based class, you do not have to import the R class explicitly when accessing your resources. However, in non-activity classes you do.
Can anyone explain why?
Yes you do...look at your import list. If you're using Eclipse, you may have to expand it to see it. R is a generated class file and has to be imported like any other class you wish to use.