0

I have an error problem with compileKotlin in IntelliJ IDEA. Tried changing the previous jvm or java version but still having the error as shown. can anyone help me solve this problem?

this is a picture of the problem

Gibin Ealias
  • 2,751
  • 5
  • 21
  • 39

1 Answers1

1

Does App.kt have this at the top?

package kotlin.kotlin.unit.test

You'll get that Only the Kotlin standard library is allowed to use the 'kotlin' package error if you do that - your package names can't start with kotlin.. Just use com.example.coolapps or something if you don't have your own domain.

If you rename it, Android Studio will complain that the package name doesn't match the file's location (the package needs to match the folder structure - see in the path it's currently kotlin/kotlin/unit/test) but if you Alt+Enter or click the light bulb icon, it'll offer to move it to com/example/coolapps for you

cactustictacs
  • 17,935
  • 2
  • 14
  • 25
  • app/src/main/kotlin/kotlin/unit/test/App.kt I'm using IntelliJ IDEA, from the first time I made an application like this. So what should I do? – Dendi Prayogo Hidayat Dec 23 '21 at 04:56
  • @DendiPrayogoHidayat Android Studio is based on IDEA so it should still work. Every Android app needs a package name - there's some info here: https://stackoverflow.com/q/6273892 Your package name isn't allowed to start with ``kotlin`` as the first part, so you need to change it. Here's a way you can change it for the whole app: https://abhiandroid.com/androidstudio/how-to-change-package-name-android-studio.html – cactustictacs Dec 23 '21 at 18:22
  • it's solved. thank you brother. appreciated – Dendi Prayogo Hidayat Dec 24 '21 at 05:51