I keep getting an IllegalStateException error in the event log while creating new activity
in android studio:
11:27:15 InvalidReferenceException: Error executing FreeMarker template: The following has evaluated to null or missing:
==> srcDir [in template "root://activities/common/common_globals.xml.ftl" at line 41, column 34]
Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use when-presentwhen-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??
An activity provides the window in which the app draws its UI. This window typically fills the screen, but may be smaller than the screen and float on top of other windows. Generally, one activity implements one screen in an app.
Go to "Edit Configurations..." in the "Run" menu. In the left pane, select your application. In the right pane, in the "General" tab, in the "Launch Options" section, there is a "Launch:" dropdown. Select "Specified Activity", and enter the name of your activity as it appears in your Manifest.
Method 1:Just Remove the following code from your app level build.gradle
debug {
storeFile file('/Users/Razz/Documents/keys/keystore.jks')
storePassword 'ABC@123'
keyAlias 'key0'
keyPassword 'ABC@123'
}
Method 2: In case, if there are two packages together (kotlin and java)
I was facing the same problem as whenever I create new activity form the activity templates provided by the android studio. Nothing was happening even after Gradle sync completes successfull.
After a long item, I figure out that, java directory name inside my project changed into kotlin somehow. And I supposed Android Studio looking for the java package to create new Activity.
Then, to solve this issue, I follow the below steps:
../ProjectName/app/src/main/
kotlin
directory instead of java
.
java
.I experienced to same issue 2 day ago and i solve it by update the below text. Check to gradle.build app and module to newer versions.
classpath 'com.google.gms:google-services:4.3.4'
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