LoginSignup
2
0

More than 1 year has passed since last update.

Google Mobile Ads Unity Pluginのバージョンアップをしたらよくわからないエラーが出た話

Posted at

前置き

  • しばらくアップデートを放置していたアプリを色々アップデートしてたら、Androidビルドでエラーになってしまう状況に……

環境

  • MacOS 12.6
  • Google Mobile Ads Unity Plugin v7.3.1
  • Unity 2021.3.16f1

事象

  • Androidビルド時に以下のようなエラー
    68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f38373731332f61663565346266382d616464612d343630332d633331332d6333663238656136356139652e706e67.png
    java.io.IOException: Can't read [/Users/ユーザ名/.gradle/caches/transforms-2/files-2.1/40a5c5778e44c6cefe581fe0507a8adc/googlemobileads-unity-runtime.jar(;;;;;;;**.class)] (Can't process class [com/google/unity/ads/AdNetworkExtras.class] (Unsupported version number [55.0] (maximum 54.0, Java 10))) See the Console for details.
    

解決方法

  1. Player Settings > Publishing Settings > Builsで、Custom Base Gradle Templateをチェック
    image.png

  2. 1で追加された.gradleファイルを修正

    allprojects {
        buildscript {
            repositories {**ARTIFACTORYREPOSITORY**
                google()
                jcenter()
                mavenCentral()  // ★★★★★追記★★★★★
            }
    
            dependencies {
                // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
                // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
                // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
                // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
                classpath 'com.android.tools.build:gradle:4.0.1'
                classpath 'com.guardsquare:proguard-gradle:7.1.0'  // ★★★★★追記★★★★★
                **BUILD_SCRIPT_DEPS**
            }
        }
    
        repositories {**ARTIFACTORYREPOSITORY**
            google()
            jcenter()
            flatDir {
                dirs "${project(':unityLibrary').projectDir}/libs"
            }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
  3. そのまま再ビルド!

  4. 無事.aabファイルができた!

感想

  • 最近Unsupported version number [55.0] (maximum 54.0, Java 10)をよく見かけるようになった気がするけど気のせい?

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0