Android Studio 1.5 started prompting error while I try to create a new Activity, check attached image:
1. Which one of the following is not a valid class name? Explanation: You declare a class with the class keyword and an arbitrary class name. Class names can be any combination of numbers and letters, although they must not begin with a number.
It is very easy to choose a valid class name or selectors in CSS just follow the rule. A valid name should start with an underscore (_), a hyphen (-) or a letter (a-z)/(A-Z) which is followed by any numbers, hyphens, underscores, letters.
1shopproduct is NOT a valid class name (in Java) , because according to Java Class naming rules, class name never starts with a number .
The simplest way is to call the getClass() method that returns the class's name or interface represented by an object that is not an array. We can also use getSimpleName() or getCanonicalName() , which returns the simple name (as in source code) and canonical name of the underlying class, respectively.
its because in Project Pane you haven't selected your java package. Select your java package then try to add new activity or fragment. it worked for me :)
Wrong Selection:
Right Selection:
It's a bug in Android studio 1.5 ,just add your package name manually and it will get fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With