quik icon indicating copy to clipboard operation
quik copied to clipboard

❓ [ QUESTION ] How to build?

Open thateffinlinuxguy opened this issue 1 year ago • 7 comments

Summary:

I muddled around and ended up with some kind of debug build but would like to confirm since I am largely unfamiliar with android development.

  • Want to check if my steps are more or less correct
  • What are your thoughts on a BUILD.md or the like? If I get the correct steps down and clean up the write up for it would that be something acceptable as a PR?
  • Some follow-up questions at the end that came up during the process that I am not sure on

Detail:

I have experience with Java but I've never worked with Android development before so apologies in advance if I am missing something obvious.

Anyway, my goal with this was just to build a simple debug apk from the master branch and test that it worked on my phone before I started playing around with anything else.

I'm on Fedora Linux and here's what I did that eventually worked (I'm including the stuff that's probably not needed for builds in case the error messages are important):

First attempt (cli build using included gradlew):

$ java --version
openjdk 17.0.9 2023-10-17
OpenJDK Runtime Environment (Red_Hat-17.0.9.0.9-4) (build 17.0.9+9)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.9.0.9-4) (build 17.0.9+9, mixed mode, sharing)
 
$ git clone git clone https://github.com/octoshrimpy/quik
$ cd quik
$ git status
On branch master
Your branch is up to date with 'origin/master'.
 
nothing to commit, working tree clean     
  
$ ./gradlew tasks
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :android-smsmms
WARNING: The option setting 'android.defaults.buildfeatures.buildconfig=true' is deprecated.
The current default is 'false'.
It will be removed in version 9.0 of the Android Gradle plugin.
You can resolve this warning in Android Studio via `Refactor` > `Migrate BuildConfig to Gradle Build Files`
 
> Configure project :data
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
  
> Configure project :domain
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
 
> Configure project :presentation
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
presentation: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'io.realm:realm-annotations-processor:10.16.0', 'io.realm:realm-annotations-processor:10.16.0'.
 
FAILURE: Build failed with an exception.
 
* Where:
Build file '/media/hdd2/Code/Android/sms/quik/presentation/build.gradle' line: 52
 
* What went wrong:
A problem occurred evaluating project ':presentation'.
> Keystore properties file not found.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
 
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
 
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
 
For more on this, please refer to https://docs.gradle.org/8.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 34s

Second attempt

Based on the above with Keystore properties file not found. I poked around a bit in .gitignore and presentation/build.gradle and realized that there does not appear to be a 'debug' target (unless I am reading things incorrectly) and you must create the release data (like keystore) even if you just want a one-off debug build.

So I created a file at ./.gradle/.gradlerc and filled it with the following dummy info:

storePassword=my.keystore
keyPassword=key_password
keyAlias=my_key_alias
storeFile=my-release-key.keystore  

after that I ran ./gradlew clean build which also failed then ./gradlew assembleDebug which seemed to work and gave me this:

$ find . -type f -iname '*.apk'
./app/build/outputs/apk/debug/app-debug.apk
./presentation/build/outputs/apk/noAnalytics/debug/QUIK-v4.0.7-noAnalytics-debug.apk
./presentation/build/outputs/apk/withAnalytics/debug/QUIK-v4.0.7-withAnalytics-debug.apk

The app-debug.apk was already in the repo to start with. But does the rest of the build process seem more or less correct to you (e.g. the storeFile and ./gradlew assembleDebug parts - the rest I was providing more for completeness / in case any of the errors were relevant / helpful to people searching for them)?

Final questions:

  1. Is the expectation that a keystore file should exist for debug builds or I should be doing something else? If not and they are supposed to only be for release builds, would there be any interest in having the build scripts updated so that e.g. ./gradlew assembleDebug works out-of-the-box after cloning?
  2. Since I pretty much made up the dummy values I used in my .gradlerc based on a combo of this + values in the build.gradle file - Do any of those look like they could potentially be problematic for me later (assuming I'm only doing debug builds)?
  3. (Only applicable if you are interested in having me write up a BUILD.md - I won't need this myself otherwise) - In the event of you ever getting sick of maintaining the project, is there a link you could share that covers what is the process for setting up the release version of the keystore for signing to play store / fdroid?

thateffinlinuxguy avatar Apr 08 '24 04:04 thateffinlinuxguy

@thateffinlinuxguy @octoshrimpy I submitted pull request #309, that partially address this, by submitting basic contributing guidelines, however I built the app by commenting out the signing keys configuration in the build.gradle file. Do you think that this should be added to that file? I am open to whatever people think is best.

Inhishonor avatar Feb 25 '25 17:02 Inhishonor

Merged. Keeping this open until @thateffinlinuxguy can compile correctly. for debugging, compiling without keys should be fine.

octoshrimpy avatar Mar 01 '25 18:03 octoshrimpy

I would love to see a Build.md. I'm working through Gradle issues and so far I've had to upgrade Kotlin to 1.9.21 to get past a kept annotation IllegalAccess error. I would also be up for contributing to any kind of build guide writing.

johngoren avatar Jun 09 '25 19:06 johngoren

@Inhishonor just pushed some stuff for debugging builds over at #477 @johngoren if you'd like to take a look!

octoshrimpy avatar Jun 09 '25 20:06 octoshrimpy

I'm working through Gradle issues and so far I've had to upgrade Kotlin to 1.9.21 to get past a kept annotation IllegalAccess error.

That is very weird, I have not had to do that. (Update Kotlin). Everything should work right out of the box. Are you having any more problems?

Inhishonor avatar Jun 09 '25 23:06 Inhishonor

My Gradle skills are mediocre, so maybe I'm missing something. Here's what my build process has been.

First I cloned a fresh copy from the latest Quik commit, and ran into the following IllegalAccess error.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':domain:kaptDebugKotlin'...

Caused by: java.lang.IllegalAccessError: superclass access check failed: class org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler (in unnamed module @0x63143ac9) cannot access class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.main to unnamed module @0x63143ac9
	at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:35) 

This goes away if I upgrade ext.kotlin from 1.7.20 to 1.9.1, following a Stack Overflow post I found (I know this is about Firebase and Quik uses Realm, but I thought I'd try the advice out)

I also updated the Android Gradle Plugin from 8.2.2 to 8.10.1, following Android Studio's recommendation. But then I got these errors:

The 'kotlin-android-extensions' Gradle plugin is no longer supported. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.

I also am trying to get past some "inconsistent JVM-target compatibility" errors. I don't know what could be giving the compiler the idea that I want to use version 21, as source and target compatibility are set to 1.8 throughout the gradles.

`

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21). `

Any thoughts on what could be wrong here? Again I'd be happy to write a Getting Started guide.

johngoren avatar Jun 10 '25 12:06 johngoren

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':domain:kaptDebugKotlin'... Caused by: java.lang.IllegalAccessError: superclass access check failed: class org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler (in unnamed module @0x63143ac9) cannot access class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.main to unnamed module @0x63143ac9 at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:35) This goes away if I upgrade ext.kotlin from 1.7.20 to 1.9.1, following a Stack Overflow post I found (I know this is about Firebase and Quik uses Realm, but I thought I'd try the advice out)

I am guessing this is because a withAnalytics build was built accidentally. The withAnalytics is not used anymore and doesn't even work.

I also updated the Android Gradle Plugin from 8.2.2 to 8.10.1, following Android Studio's recommendation. But then I got these errors:

The 'kotlin-android-extensions' Gradle plugin is no longer supported. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.

Unfortunately as the error message states, we can't update gradle at the moment because of some deprecated components.

I also am trying to get past some "inconsistent JVM-target compatibility" errors. I don't know what could be giving the compiler the idea that I want to use version 21, as source and target compatibility are set to 1.8 throughout the gradles.

Did you download and set a java installation, as mentioned in the contributing guidelines?

My guess now, would be to reset the project to the last commit. Specify explicitly that a debug build should be built. (Or simply copy and paste the build.gradle file from my pull request) and see what happens.

My Gradle skills are mediocre

Don't worry, Gradle is an abomination to humanity. 😦

Again I'd be happy to write a Getting Started guide.

That would be good, maybe a good place would be in the wiki?

Hope that works!

Inhishonor avatar Jun 11 '25 00:06 Inhishonor