-1

I am trying to call a static variable in android but I am receiving an error.

URL class
public class URL{
  public static String url ="xxxxxxxx";
}

Second Class{
   private static String newUrl = MyURL.url;
}

but I am getting errors

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/example/system2/tranxav/url/URL;

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
user2940930
  • 93
  • 1
  • 9

2 Answers2

1

Try this ..

public class URL{
public static String url ="xxxxxxxx";
}

Class second{
private static String newUrl = URL.url;
}
0

Check your class name properly.

public class MyURL{
  public static String url ="xxxxxxxx";
}
Second Class{
   private static String newUrl = MyURL.url;
}

this error occurs because you access url from wrong class name.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163