HabitRPG / habitica-android

Native Android app for Habitica
GNU General Public License v3.0
1.41k stars 508 forks source link

Problem following instructions in README file for buildin android app. #2035

Closed diyoyo closed 6 months ago

diyoyo commented 11 months ago

Describe the bug A clear and concise description of what the bug is. If your issue is not related to a specific bug, please submit it as a suggestion through our form: https://forms.gle/Fa6oztkDsbzLqSvE9

To Reproduce Steps to reproduce the behavior: Following README instruction to build the app using Android Studio

Expected behavior Successful compilation

Screenshots It seems like the .debug namespace used for Firebase doesn't match any more the gradle config. I am suspecting that the README file is out of date compared to this commented out line:

image

This is likely causing config problems, resulting in loss of BuildConfig variables like here:

image

At the end of the day, I am with this first error out of 12: e: file:///Dev/AndroidLab/habitica-android/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/Analytics.kt:84:50 Unresolved reference: STORE

Smartphone (please complete the following information):

Additional context

dokkis commented 11 months ago

I faced the same issue, additionally, if I change the .STORE with .DEBUG that is present on BuildConfig class, the compilation still fails for me with following errors:

e: file:///Users/dokkis/Documents/Projects/habitica-android/Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/ClassSelectionActivity.kt:78:32 Unresolved reference: isClassSelected e: file:///Users/dokkis/Documents/Projects/habitica-android/Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/ClassSelectionActivity.kt:210:45 Unresolved reference: opt_out_description e: file:///Users/dokkis/Documents/Projects/habitica-android/Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/ClassSelectionActivity.kt:226:49 Unresolved reference: change_class_confirmation_message e: file:///Users/dokkis/Documents/Projects/habitica-android/Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/ClassSelectionActivity.kt:276:72 Unresolved reference: choosing_class_progress

dokkis commented 11 months ago

@phillipthelen I reverted locally the last commit https://github.com/HabitRPG/habitica-android/commit/7d230ecfa1e5c621ef9b1f543e07f231cf7d26d1 and it seems to compiling just fine now. Is it possible you missed to commit some files, there are some straightforward things missing, such as missing strings in the xml file, e.g. opt_out_description, change_class_confirmation_message and choosing_class_progress and other stuff that prevent the project to compile. Also the error about the BuildConfig.STORE is gone after reverting the last commit you made. Can you please take a look into it?

By reverting I can run the app in the emulator, but I see following error now making the app crashing


          * Invalid application ID. Follow instructions here:                          *
          * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
          * to find your app ID.                                                       *
          * Google Ad Manager publishers should follow instructions here:              *
          * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
                                                                                                ******************************************************************************

it might require additional config that is not present in the README.

nikonhub commented 11 months ago

Even after reverting the last commit I have a problem to login.

Here the login throws. It throws because because in ApiClientImpl we're trying to setUserID to Amplitude. But Amplitude is never initialized in debug mode here.

Locally I've commented the line. But I don't know how should we proceed to make it work.

Maybe place a guard in every method of AmplitudeManager like it's the case for sendEvent

    fun sendEvent(
        eventAction: String?,
        eventCategory: String?,
        hitType: String?,
        additionalData: Map<String, Any>? = null
    ) {
        if (BuildConfig.DEBUG) {
            return
        }
diyoyo commented 11 months ago

Hi, I've made it work a while ago, but I had to do so many changes that I don't know which one will help. I didn't have to modify the code, only the config files.

Anyways, I was about to push a commit on my personal fork, but I'm too new to this, I feel shy making my changes public at the moment.

But again, here below you can see that there shouldn't be any need to alter code, as far as I'm concerned.

image

Also, every time, I have to make sure that the correct flavor is selected for all modules of the app, because many times, changing one does not necessarily synchronize properly the others.

image
nikonhub commented 11 months ago

Yes the app builds. But can you login ?

diyoyo commented 11 months ago

Well, I can login to the accounts I have set up on my self-hosted instance. Of course, this is separate from the official habitica network.

saraolson commented 10 months ago

assigned our developer to take a look at the readme instructions when he has a chance. we've been doing a lot of important maintenance and optimizations recently, so it may be a bit before we have to time to dig into this. thanks for your feedback and patience!

jsoberg commented 8 months ago

I followed the README steps re: setting habitica files and grabbing the google-services json and was able to sync/build without trouble.