Android Studio complains "unsupported version of Gradle" when trying to codesign APK?

#1

I have an OF 10.1 project which builds an unsigned debug APK (using Android Studio 3.5) which works fine when manually installed on devices.

But now that i am trying to use Android Studio’s “Generate Signed APK” feature, it complains that

“The project is using an unsupported version of Gradle. Please point to a supported Gradle version in the project’s Gradle settings or in the project’s Gradle wrapper (if applicable.)”

I tried running the linked suggestions to upgrade, fix, and re-import things, but Android Studio continues to complain, and I’m not sure what the next step should be, and figure someone here probably already knows the answer.

Do I need to be using some particular older version of Android Studio, or some components, such as Gradle?

Do I just need to edit the project’s Gradle files to say it’s ok to use whatever version of Gradle is actually on my dev machine?

#2

From what I’ve been able to glean so far, it looks like the gradle versions mentioned in two (?) settings files need to be the “right” ones. Would anyone point me to either the right versions to specify, or where/how I might be able to determine the right versions to specify in those files?

I notice that in my project’s build.gradle file created by the OF project generator, there is a comment:

        // Using the gradle-experimental version that supports c++
        classpath 'com.android.tools.build:gradle-experimental:0.9.3'

But apparently this needs to be set to be compatible with the line in gradle\wapper\gradle-wrapper.properties that from whatever source was set to:

    #distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

I tried adjusting them individually and separately to different versions that Internet Q&A results suggested might make sense, but they never built and just changing those text files got Android Studio to start freaking out about Gradle possibly running too many instances or being corrupt.


So I did the “Invalidate Caches and Restart” thing, and it’s back to how it was originally, able to build but when asked to make a code-signed APK, it’s:

The project is using an unsupported version of Gradle.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)

Which again makes me wonder if I need to use an older version of Android Studio? It doesn’t mention what thinks the version of Gradle in the settings isn’t “supported”?

@FedeBlock This looks to me like a similar problem to the one you reported in this other question which didn’t seem to get answered.

@Irene You has asked (a couple of years ago) on that other thread if anyone had had issues getting OF to run in Android Studio version 3.0. Is this Gradle issue with code-signing the APK one you’re familiar with, or might you know what Gradle versions to specify?

#3

Another way to ask this might be, has anyone been able to codesign an OF APK for Android?

If so, what versions of Android Studio and Gradle did you use?

#4

I made some progress (I think) understanding (sort of) the issues here, but after many efforts have not been able to get it to codesign.

I tried asking a question about it on Stack Overflow.

#5

I’ve been pounding my head against this for a few more days now.

I just updated my question on SO and put a bounty on it. https://stackoverflow.com/questions/58565006/how-can-i-codesign-a-64-bit-android-apk-using-the-gradle-experimental-plugin