简体   繁体   中英

Unity Error: Minimum supported gradle version is 5.1.1

This is so frustrating and confusing! If anyone can help me understand what's wrong, I'd greatly appreciate it!

I'm building a Unity app, and per the directions from ironSource, I have to use a custom gradle template so I can set a couple of flags or whatever.

1. This is my Android Studio version :

在此处输入图片说明

2. This is the error I get when attempting to build in Unity : 在此处输入图片说明

3. This is the edited gradle-wrapper.properties file with 5.1.1-all set : 在此处输入图片说明

4. This is my mainTemplate.gradle

buildscript
{
    repositories
    {
        google()
        jcenter()
    }

    dependencies
    {
        classpath 'com.android.tools.build:gradle:3.4.1'
    }
}

allprojects
{
   repositories
   {
      google()
      jcenter()

      flatDir
      {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.application'

dependencies
{
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    implementation 'com.android.support:support-v4:27.1.1'

    **DEPS**

    implementation 'com.google.android.gms:play-services-ads:17.2.0'
}

android
{
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    defaultConfig
    {
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
    }

    lintOptions
    {
        abortOnError false
    }

    aaptOptions
    {
        noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
    }

    **SIGN**

    buildTypes
    {
        debug
        {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
        }

        release
        {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            **SIGNCONFIG**
        }
    }
}

If anyone knows how to fix this, please share! I've ready through all of the similar problems here on SO, but none of the supposed solutions work. I keep changing version numbers all over the place, and still, errors.

On top of that, my Unity CloudBuild also fails, with similar problems. I don't have control over what versions they have, so I can't even begin to plan on how to fix that.

Please help!! and thank you sincerely!

-Matt

Remember to link your project to setting.gradle , eg

include ':app'
include ':your-module'

And Clean up your project and then perform a new Sync.

  • Try " File "->" Invalidate Caches / Restart ... "
  • Try to clean up your .gradle and .idea directory under your project root directory.

And, ensure that you are using gradle wrapper, see below screenshot:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM