-2

I get an error saying 'the constructor file[string] is not visible. Why am I getting this when I have declared both my method and class as public.

package appium1;

import static org.junit.Assert.*;

import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;

import com.gargoylesoftware.htmlunit.javascript.host.file.File;

import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;

public class desiredcap {

@Test
public void test() {
    File appDir = new File("src");
    File app = new File(appDir, "BookMyShow.apk");

    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(MobileCapabilityType.PLATFORM,MobilePlatform.ANDROID);
    cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
   }
}
Brian
  • 5,069
  • 7
  • 37
  • 47
Gaurav Thantry
  • 753
  • 13
  • 30
  • 4
    Please put all of the details of the question, in your question. – Steve Smith Mar 14 '17 at 16:25
  • Try [this](http://stackoverflow.com/questions/25530382/the-constructor-is-not-visible-error). Second answer: "No access modifier for your constructor makes it package private." – Brian Mar 14 '17 at 16:28

3 Answers3

5

You propably did import File class from the wrong package. What you want mostly is java.io.File

SilverNak
  • 3,283
  • 4
  • 28
  • 44
4

You are not using the normal Java File class, but rather something from Gargoyle Software.

Steve Smith
  • 2,244
  • 2
  • 18
  • 22
0

You probably imported wrong a class, try java.io.File

P. Ope
  • 13
  • 5