On using import android.hardware.camera2. I am getting import cannot be resolved. How to clear this problem. I tried everything mentioned in other solution but I am not able to fix this up. Please do help. Thanks in advance.
Asked
Active
Viewed 1.4k times
9
-
2Edit your question to show your code, please. Note that `android.hardware.camera2` itself is just a Java package; you import classes, not packages. If you literally have `import android.hardware.camera2;`, you would need to change that to `import android.hardware.camera2.*;` or something. – CommonsWare Aug 23 '15 at 18:49
-
1In my code I want to use new api android.hardware.Camera2. To use that I am trying to import it but I am not able to do so since it's snowing that "The import android. hardware. Camera2 cannot be resolved". – Nandan A Aug 23 '15 at 18:56
1 Answers
15
I want to use new api android.hardware.Camera2
There is no Java class in Android named android.hardware.Camera2
. There is a Java package named android.hardware.camera2
. You are welcome to use classes out of that Java package, such as android.hardware.camera2.CameraManager
.
"The import android. hardware. Camera2 cannot be resolved"
That is because there is no Java class in Android named android.hardware.Camera2
. There is a Java package named android.hardware.camera2
. You are welcome to use classes out of that Java package, such as android.hardware.camera2.CameraManager
, via import
statements like:
import android.hardware.camera2.CameraManager;
or even:
import android.hardware.camera2.*;

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
2Thanks. My mistake was that I was using android.hardware.Camera2 in place of android.hardware.camera2. Thanks – Nandan A Aug 23 '15 at 19:02