Slion / Fulguris

⚡Web Browser
http://fulguris.slions.net
Other
456 stars 48 forks source link

Fails to build out-of-the-box. (Sponsorship) #644

Open StevanWhite opened 1 week ago

StevanWhite commented 1 week ago

Description

The project fails to build out-of-the box on latest Android Studio.

Environment

To reproduce

Steps to reproduce the behaviour:

  1. git clone https://github.com/Slion/Fulguris.git
  2. open Fulguris project in Android studio
  3. allow to synch
  4. build
  5. see error:

    Cannot find symbol class Sponsorship $PROJECTS$/Fulguris/app/build/generated/source/buildConfig/androidTest/slionsFullDownload/debug/fulguris/test/
    BuildConfig.java:17: error: cannot find symbol public static final Sponsorship SPONSORSHIP = Sponsorship.BRONZE;

Expected behaviour

It should just build.

Additional

I made no changes to the source, and just use the AS distro JDK, etc.

Slion commented 1 week ago

Last I checked the build server worked so it's likely to be the usual configuration issues with Android Studio. Try to build another flavor maybe, the F-Droid one maybe. Make sure you clear the Android Studio caches and clean things up properly by deleting the proper directories. Maybe just clone the repo in a new folder and try again if you are not familiar with sorting out Android Studio issues. It could also be that they changed something in the latest Android Studio version and that things need adjusting again.

StevanWhite commented 1 week ago

I see no declarations of "Sponsorship" anywhere in this project. Where should that come from?

The "flavor" menu is grayed out. Is this a clue?

I have deleted .gradle/ and clear-caches-restarted. No smiles.

I am horribly familiar with sorting out AS issues.

I tried updating all the dependencies... now I'm getting an error I didn't see before: the dreaded "Duplicate class found" (But this is not the original issue... this is a general Gradle issue.)

StevanWhite commented 1 week ago

Update: I got build flavors now.

AS wanted to update something about "test coverage", and I let it do that. Now I was able to build the F-Droid release variant, and... same problem.

OK. I'm debugging the thing for you now.

I found the root of the first problem. The gradle property android.defaults.buildfeatures.buildconfig has been deprecated. It now no longer functions.

Instead, under android{} in build.gradle: buildFeatures { buildConfig = true }

NOW it finds "Sponsorship". Not building yet. Will advise.

StevanWhite commented 1 week ago

Updated dependencies and re-built.
Now get "Duplicate class found" info.guardianproject.netcipher.R found in modules netcipher-2.1.0.jar -> jetified-netcipher-2.1.0 (info.guardianproject.netcipher:netcipher:2.1.0) and netcipher-webkit-2.1.0.jar -> jetified-netcipher-webkit-2.1.0 (info.guardianproject.netcipher:netcipher-webkit:2.1.0)

Known problem. https://gitlab.com/guardianproject/tormobile/NetCipher/-/issues/17

Tried downgrading

// tor proxy
implementation "info.guardianproject.netcipher:netcipher:2.0.0-alpha1"
// Updating this breaks our build
implementation 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1'

That gets rid of the Duplicate class problem.

Next: Missing class org.jspecify.annotations.NullMarked (referenced from: org.jsoup.internal.FieldsAreNonnullByDefault and 2 other contexts)

Try adding dependency: implementation 'org.jspecify:jspecify:0.3.0'

Now it builds.

I can give you further help, if you're unfamiliar with sorting out Android Studio problems!

StevanWhite commented 1 week ago

Let me clarify some of that.
The main problem, and the one I had the most trouble figuring out, is the deprecated

android.defaults.buildfeatures.buildconfig

This deprecation is not new. You should be able to remove that directive, and replace it with

buildFeatures {
    buildConfig = true
}

under android{} in build.gradle.

Cheers!