Reputation: 751
I'm trying to use NetworkUtils class in android and it shows the error like in the following image, how is this even possible?
Upvotes: 1
Views: 2858
Reputation: 6622
I think you are using
compile 'com.blankj:utilcode:1.5.0'
AndroidUtils
lib for common utils.
If you are using this lib then you have to write below line in Application
class
`com.blankj.utilcode.util.Utils.init(this); `
Upvotes: 0
Reputation: 34744
I assume you're talking about the Udacity class and not the built-in Android class because the latter doesn't have a method called buildUrl()
(and isn't public as mentioned in the comments).
In that case, you should make sure you:
NetworkUtils.java
in your source codeimport com.example.android.datafrominternet.utilities.NetworkUtils;
(unless you moved it to another package)If the file is already in the source code, or in a library you are using, you can also hit Alt+Enter while the cursor is on the error. It should open a quick fix window. The first option should be importing the class from the appropriate place.
Upvotes: 1