savvasdalkitsis / uhuruphotos-android

🖼️A modern media gallery, with features like backup/sync, semantic search, media map, face recognition, memories and much more built using the latest Android technologies.
https://uhuru.photos
Apache License 2.0
361 stars 28 forks source link

Please give instructions on building #515

Closed clsty closed 10 months ago

clsty commented 10 months ago

In order to try my translation, I tried to build this project under Linux using:

./gradlew assembleDebug

but it reported errors:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':feature:feed:domain:implementation:transformDebugClassesWithAsm'.
> A failure occurred while executing com.android.build.gradle.tasks.TransformClassesWithAsmTask$TransformClassesFullAction
   > Error occurred while instrumenting class com.savvasdalkitsis.uhuruphotos.feature.feed.domain.implementation.broadcast.CancelFeedDetailsDownloadWorkBroadcastReceiver

I applied the PR's by the bot manually to upgrade versions info and ./gradlew clean and tried again. This time it reported

> Task :app:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.

And I tried sudo sdkmanager "extra:google;google_play_services" then ./gradlew assembleDebug again, same error.

Then I tried cp mock-google-services.json app/google-services.json and then again. The error becomes:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':feature:feed:domain:implementation:transformDebugClassesWithAsm'.
> A failure occurred while executing com.android.build.gradle.tasks.TransformClassesWithAsmTask$TransformClassesFullAction
   > Error occurred while instrumenting class com.savvasdalkitsis.uhuruphotos.feature.feed.domain.implementation.broadcast.CancelFeedDetailsDownloadWorkBroadcastReceiver

Is there anything I've missed to build this project? I hope you could give instructions on how to build this project. Thank you!

clsty commented 10 months ago

Ok, so I have figured it out by myself.

After running ./gradlew assembleDebug --stacktrace, it gave:

...
Caused by: java.io.FileNotFoundException: /tmp/uhuruphotos/feature/feed/domain/implementation/build/intermediates/javac/debug/classes/com/savvasdalkitsis/uhuruphotos/feature/feed/domain/implementation/broadcast/Hilt_CancelFeedDetailsDownloadWorkBroadcastReceiver.class (No such file or directory)
at dagger.hilt.android.plugin.AndroidEntryPointClassVisitor.hasOnReceiveBytecodeInjectionMarker(AndroidEntryPointClassVisitor.kt:205)
at dagger.hilt.android.plugin.AndroidEntryPointClassVisitor.visitMethod(AndroidEntryPointClassVisitor.kt:106)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1354)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at com.android.build.gradle.internal.instrumentation.AsmInstrumentationManager.doInstrumentByteCode(AsmInstrumentation3385 actionable tasks: 3385 executed
Manager.kt:225)
at com.android.build.gradle.internal.instrumentation.AsmInstrumentationManager.doInstrumentClass(AsmInstrumentationManager.kt:257)

And then, /tmp/uhuruphotos/feature/feed/domain/implementation/build/intermediates/javac/debug/ has no classes folder under it but a compileDebugJavaWithJavac ; however, the /tmp/uhuruphotos/feature/feed/domain/implementation/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/savvasdalkitsis/uhuruphotos/feature/feed/domain/implementation/broadcast/Hilt_CancelFeedDetailsDownloadWorkBroadcastReceiver.class do exists!

So the remaining is easy, just copy /tmp/uhuruphotos/feature/feed/domain/implementation/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes folder to /tmp/uhuruphotos/feature/feed/domain/implementation/build/intermediates/javac/debug/classes.

And do the build again, now it works!

Well, but I'll keep this issue open temporarily, because I still suggest that a building instruction would be nice.

I've made a repo to detail the process, but with workarounds (not fixes): https://github.com/clsty/uhuruphotos-android-testbuild

savvasdalkitsis commented 10 months ago

The issue with CancelFeedDetailsDownloadWorkBroadcastReceiver should be fixed now.

Simply copyinng the mock google-services.json in the app folder should be enough to build now