-1

I have two example imports.

import android.os.MessageQueue;
import android.os.PerformanceCollector;

Both files, after tracking them down, is in Android/Sdk/sources/android-19/android/os. MessageQueue.java and PerformanceCollector.java.

In my Android Studio->Project Structure->SDK Location, Android/Sdk is marked.

MessageQueue works. PerformanceCollector gives "Cannot resolve symbol 'PerformanceCollector'".

Cleaning/invalidating caches/restarting/reimporting did not work. Can someone suggest what might be the cause of this? It would be appreciated.

  • you `"Cannot resolve symbol 'PerformanceCollector'"` because this class is not part of public SDK – pskink Oct 27 '16 at 09:22
  • @pskink But, um. It's in my project, and my colleague (who's absent and can't help me) is using the code and it works as it is. It can't be that we can't use it. So, what do I instead do to use it, then? – PlatinumSkink Oct 27 '16 at 09:25
  • you could try copying the sources of it to your project – pskink Oct 27 '16 at 09:28
  • But they've obviously done something where they didn't need to do that before I started working on this and couldn't get it to work on my computer. ... Oh, well. Thank you for your input. From this, I can seek on the assumption that this is the cause. Phew. Alright. More googling to do. – PlatinumSkink Oct 27 '16 at 09:32
  • @pskink Thank you very much. You pointed me in the right direction, and from there I could find the rest. Thank you, once again. – PlatinumSkink Oct 27 '16 at 13:13

2 Answers2

0

I don't know why I didn't find the PerformanceCollector class in Android Documentation but you can use this code. Just create a new class in your application

PerformceCollector Source code

Geet Choubey
  • 1,069
  • 7
  • 23
  • can you see `"{@hide} Pending approval for public API."` in the comments? it means that it is not part of public SDK – pskink Oct 27 '16 at 09:19
  • I know I could do that. But, I'd really, REALLY rather not, when I actually have found the actual location of the import code and should just be able to import it. This isn't the only import that's not working, I just hoped that by learning what was causing this one I could solve the rest, too. There are more that works than those that don't, but I'd really not have to include those that don't in the application. But thank you. ... Huh. – PlatinumSkink Oct 27 '16 at 09:20
0

pskink was correct. The reason I was seeing an error was because the class "PerformanceCollector" was hidden by {@hide}. However, having done further research from there I have found that this isn't an issue at all.

How can Android project compile when imported class is missing in SDK? - From reading the answer to this question, I have found that the error will not appear when running the application at runtime, so the fatal error I am getting has nothing to do with the issue I asked this question about. It was unrelated, as I now know what the real cause was.

So, pskink answered with a comment and not a proper answer, so I can't mark him/her as being correct. So, this will do. Thank you all who've read my question and so on.

Community
  • 1
  • 1