question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android targetSDK and android kotlin source folder

See original GitHub issue

I made a fresh new project with the latest release using the Kotlin language option and in my opinion two things could be improved:

  1. Android target SDK version is 25 which produces an error in IDEA because it seems Google Play Store requires a minimum version of 26. I changed the target and compile sdk version to 29 which got rid off this error but I am not 100% sure if this is everything you need to do. It seems to work for me but I am no gradle android expert

  2. The lwjgl3 backend correctly recognizes src/main/kotlin as a source directory. The android backend does not do that. You need to adjust the build.gradle file and replace the …/java folders to …/kotlin. Would be great if the setup took already care of that. Maybe you can leave out those fixed file paths and then it accepts both java and kotlin directory as source directories?

  3. One minor thing - why was desktop project renamed to lwjgl3? I personally would prefer if it is still called desktop.

  4. One question from me: why is the core project e.g. adding its dependencies via api instead of implementation? I thought api should be used in case you need to export these dependencies if someone is using your project as a dependency? Since you are going to develop a game or application which will not be used as a dependency, wouldn’t implementation than be the better option?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tommyettingercommented, May 29, 2020

Yep, I actually just committed 1.9.10.8 with that as the default for Kotlin projects. Drafting up a release now. I’m still not sure why Android is so hard to build right now for me; I seem to usually get out-of-heap errors or stack overflow inside Gradle on the majority of :android:assembleDebug runs. It may be some setting on my local machine, or my build tools version (28.0.3)…

I think I can close this now, since 4 and 2 seem to be solved, 3 seems to be OK as-is, and 1 is as good as I can get it (at least the versions are updated to what they should be). Thanks for the beta testing! 😃

1reaction
tommyettingercommented, May 25, 2020

Just pushed a commit that may help with point 1. I’m really struggling with this Android development work. The commit notes on 9f51d2ce9a64e5e95cf82ebdbe04d2a892fe1004 have some tips I found the hard way. I think I have an idea for Point 2; I changed in android/build.gradle

			java.srcDirs = ['src/main/java']
			aidl.srcDirs = ['src/main/java']
			renderscript.srcDirs = ['src/main/java']

to

			java.srcDirs = ['src/main/java', 'src/main/kotlin']
			aidl.srcDirs = ['src/main/java', 'src/main/kotlin']
			renderscript.srcDirs = ['src/main/java', 'src/main/kotlin']

By hand in a generated project, and it recognizes android/src/main/kotlin as a source folder now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Meet Google Play's target API level requirement
When you upload an APK, it must meet Google Play's target API level requirements. New apps must target Android 12 (API level 31)...
Read more >
CompileSdkVersion and targetSdkVersion — what is the ...
compileSdkVersion defines which Android SDK version will be used by gradle to compile your app. For example: In Android 12, so in SDK...
Read more >
Understand mobile project structure | Kotlin
Source sets. The shared module contains the code that is common for Android and iOS applications. However, to implement the same logic on ......
Read more >
Project Overview - Modern Android App Development with Kotlin
Get introduced to the Android project structure, main project files, and folders in this ... src/main/java - module source folder for Java or...
Read more >
How To Change API SDK Level In Android Studio
minSdkVersion means minimum Android OS version that will support your app ... if you are in project View then click on your project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found