Reputation: 1264
I am using kotlin as a programming in android application, even though am using kotlin as language my default application package shows as java.
But am not sure that this is the default behaviour, is it possible to change to kotlin ?
Upvotes: 3
Views: 2237
Reputation: 1106
If you are using kts gradle system, then the code suggested by jeet might not work for you.
You can try with below piece of code in app level build.gradle.kts
android.sourceSets.all {
java.srcDir("src/$name/kotlin")
}
Upvotes: 2
Reputation: 12138
Yes, you can take any name as your package name source. All you'll have to do is just provide that name to sourceSet in Android Studio.
Follow the steps:
Go to app level build.gradle file and then add code below in android block :
android {
....
sourceSets{
main.java.srcDirs += 'src/main/kotlin'
}
....
}
Now, sync the project and you're good to go.
Upvotes: 7