NamanShergill / diohub

An open-source unofficial GitHub mobile client, that aims to deliver the ultimate GitHub experience on mobile devices.
https://github.com/NamanShergill/diohub
GNU General Public License v3.0
697 stars 23 forks source link

Update build instructions in the documentation #129

Open TheSunCat opened 10 months ago

TheSunCat commented 10 months ago

Hi! I was having issues on the latest release with singing in (just boots me back to the "Sign in with Github" screen), so I decided to try the latest version from git before looking into writing an issue about this. However, the branch does not appear to build on my machine. I followed the instructions at the end of the README, but one of the dependencies appears to have changed URL from https://github.com/NamanShergill/gql to https://github.com/gql-dart/gql. I was able to get flutter pub get to run without errors by also adding a line to force it to use a very old commit:

      ref: c4fc5c50e6c772b4264d2dd173c4bac1a940c8cf

However, subsequently running flutter build apk yielded a message about Java and Gradle incompatibilities, linking me here. I followed the instructions to update the Gradle version, and now I'm getting a bunch of build errors, so I think I'm definitely missing something:

build_logs.txt

NamanShergill commented 10 months ago

Thanks for the issue, I realised I hadn't mentioned a couple of steps regarding the submodules that were added to these branches.

Also, are you sure you were on v0.4? The gql dependency you mentioned was a part of the internal branch, it's not referenced in v0.4 (It's a direct pub dependency there, not a reference to a repository). Anyway, in case you're not, fetch the latest v0.4 branch. (It had a different compilation error that I just pushed a fix for).

Then run the following command:

git submodule update --init

This should fix the dependency issues you're having, and then you should be able to build the project.

TheSunCat commented 10 months ago

My bad, I totally skipped checking out the right branch! I was indeed on internal, thanks! The dependencies now get correctly, but I get the following errors on flutter build apk:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/apm/.pub-cache/hosted/pub.dev/uni_links-0.5.1/android/src/main/java/name/avioli/unilinks/UniLinksPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 1816 bytes (99.4% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "Octicons.ttf" was tree-shaken, reducing it from 49404 to 3564 bytes (92.8% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "LineIcons.ttf" was tree-shaken, reducing it from 384876 to 6264 bytes (98.4% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 7692 bytes (99.5% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
e: /home/apm/Downloads/diohub/build/wakelock_plus/.transforms/a9b4f0f2413eb5ca9e9057468106b94a/transformed/out/jars/classes.jar!/META-INF/wakelock_plus_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/Downloads/diohub/build/share_plus/.transforms/16d34b05dfed14287d7197ee73781372/transformed/out/jars/classes.jar!/META-INF/share_plus_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/Downloads/diohub/build/package_info_plus/.transforms/1a60f7d5562a57737481a1c15b42b23b/transformed/out/jars/classes.jar!/META-INF/package_info_plus_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/transforms-3/67a38b64a8d30f6aabef7c507b0033d1/transformed/jetified-core-ktx-1.10.1/jars/classes.jar!/META-INF/core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/transforms-3/b1aef582663ecf51620fde4f750f599a/transformed/core-1.10.1/jars/classes.jar!/META-INF/core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation-jvm/1.6.0/a7257339a052df0f91433cf9651231bbb802b502/annotation-jvm-1.6.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
e: /home/apm/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10/dafaf2c27f27c09220cee312df10917d9a5d97ce/kotlin-stdlib-common-1.9.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > SigningConfig "release" is missing required property "storeFile".

* 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

BUILD FAILED in 2m 6s
Running Gradle task 'assembleRelease'...                          126.9s

┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                     │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update /home/apm/Downloads/diohub/android/build.gradle:                                    │
│ ext.kotlin_version = '<latest-version>'                                                    │
└────────────────────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleRelease failed with exit code 1

I have upgraded the kotlin version used in build.gradle to 1.6.0 as the errors suggest, but I still get the same messages.

NamanShergill commented 10 months ago

Actually the latest Kotlin version is 1.9.10, I just tested on that and it's compiling for me. If you still get an error, that means the Kotlin runtime on your system might be outdated. If you use Android Studio, you should be able to update it in settings-> languages & frameworks-> kotlin.

Also in case you are compiling a release version of the app, you might need to make a keystore. I would suggest running it as a debug app if you want to skip that part.

NamanShergill commented 10 months ago

I will add the keystore point to the build instructions as well.

TheSunCat commented 10 months ago

Actually the latest Kotlin version is 1.9.10, I just tested on that and it's compiling for me.

Right, I was looking at the errors above it which say 1.6.0 was expected. I also tried setting it to 1.9.10 in build.gradle and was met with the same build issues. I tried it again, changing my Java version from java-11-openjdk to java-17-openjdk, and the Kotlin issue went away. Still getting the keystore issue (running as debug would have lower performance, right?), so I will try again once I get that set up :)

NamanShergill commented 10 months ago

If performance is a concern for debug, then you can use the following command instead

flutter build apk --profile

It's not a release build but the performance would be equivalent to it.

TheSunCat commented 10 months ago

Thanks, it's built and installed! Should I open issues I encounter on this branch, or wait for it to be merged first?

NamanShergill commented 10 months ago

Well I do know of a lot of issues on this branch that I'm still working on, so there's a chance you might spend time writing up info with steps etc for things I might know already. Although feel free to just list out any oddities you might find in the telegram channel (it's kind of inactive at the moment, however this link would be included in the app settings in the next update) and if I see something I don't recognise we could discuss those in detail:

https://t.me/+1puUpht0nl44MjU1