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?
Asked
Active
Viewed 856 times
0
-
Try changing Kotlin/Java versions as per https://stackoverflow.com/a/69084853/12844632 – Egor Klepikov Dec 22 '21 at 14:45
1 Answers
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
-