From 2987ef56b8db66cfb541028e4c02f44d7debb527 Mon Sep 17 00:00:00 2001 From: Ram Parameswaran Date: Fri, 21 Oct 2016 14:33:44 -0700 Subject: [PATCH] Version 3.1.1 of the Google Mobile Ads Unity Plugin --- ChangeLog.txt | 11 ++++ README.md | 2 +- build.gradle | 54 ++++++++++++------- .../Assets/GoogleMobileAds/Api/AdRequest.cs | 2 +- .../Editor/AdMobDependencies.cs | 10 +--- 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6916cc3f5..d0ff092ef 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,16 @@ Google Mobile Ads Unity Plugin Change Log +************* +Version 3.1.1 +************* +- Remove dependency on Android Support Library and update GMA iOS SDK +version in `AdMobDependencies.cs`. + +Built and tested with: +- Google Play services 9.6.1 +- Google Mobile Ads iOS SDK 7.13.0 +- Unity Jar Resolver 1.2.2.0 + ************* Version 3.1.0 ************* diff --git a/README.md b/README.md index ef309fb7e..a6d05430e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ for the latest official version of the plugin. Documentation -------------- For instructions on using the plugin, please refer to -[this developer guide](//developers.google.com/admob/games#unity). +[this developer guide](//firebase.google.com/docs/admob/unity/start). Be sure to also join the developer community on [our forum](//groups.google.com/forum/#!categories/google-admob-ads-sdk/game-engines). diff --git a/build.gradle b/build.gradle index 953fedcca..349b47196 100644 --- a/build.gradle +++ b/build.gradle @@ -18,17 +18,22 @@ project.ext { if (unity_exe == null || unity_exe.isEmpty()) { unity_exe ='/Applications/Unity/Unity.app/Contents/MacOS/Unity' } - resolverPackageUri = System.getProperty("RESOLVER_PACKAGE_URI") - if (resolverPackageUri == null) { - resolverPackageUri = ( - 'https://github.com/googlesamples/unity-jar-resolver/raw/master/' + - 'play-services-resolver-1.2.1.0.unitypackage') + git_exe = System.getProperty("GIT_EXE") + if (git_exe == null || git_exe.isEmpty()) { + git_exe = System.getenv("GIT_EXE") + } + if (git_exe == null || git_exe.isEmpty()) { + git_exe = 'git' } + + resolverPackageUri = System.getProperty("RESOLVER_PACKAGE_URI") + jarResolverRepo = 'https://github.com/googlesamples/unity-jar-resolver.git' + pluginSource = file('source/plugin').absolutePath pluginBuildDir = file('temp/plugin-build-dir').absolutePath buildPath = file('temp').absolutePath exportPath = file('GoogleMobileAds.unitypackage').absolutePath - resolverPath = file('play-services-resolver.unitypackage').absolutePath + resolverDir = file("${buildPath}/jarresolver").absolutePath } // Delete existing android plugin jar file. @@ -53,18 +58,23 @@ task copyAndroidLibraryJar(type: Copy) { copyAndroidLibraryJar.dependsOn(clearJar, buildAndroidPluginJar) task downloadResolver() { - description = "Download the Play Services Resolver" - doLast { - def resolver = new File("${resolverPath}") - if (!resolver.exists()) { - new URL("${resolverPackageUri}").withInputStream{ - inputStream -> resolver.withOutputStream{ it << inputStream }} + description = "Download the Play Services Resolver" + if (resolverPackageUri != null) { + mkdir("${resolverDir}") + def resolver = new File("${resolverDir}/resolver.unitypackage") + new URL("${resolverPackageUri}").withInputStream { + inputStream -> resolver.withOutputStream { it << inputStream } + } + } else { + println 'clone ' + jarResolverRepo + def result = exec { + executable "${git_exe}" + args "clone", jarResolverRepo, "${resolverDir}" + } + if (result.exitValue == 0) { + println "Downloaded resolver from " + jarResolverRepo + } } - } -} - -task deleteResolver(type: Delete) { - delete { "${resolverPath}" } } // Build unity package using through command line interface. @@ -74,13 +84,19 @@ task deleteResolver(type: Delete) { task exportPackage() { description = "Creates and exports the Plugin unity package" doLast { + def tree = fileTree("${resolverDir}") + { + include '*.unitypackage' + } + def jarresolver_package = tree.getSingleFile() + exec { executable "${unity_exe}" args "-g.building", "-batchmode", "-projectPath", "${pluginBuildDir}", "-logFile", "temp/unity.log", - "-importPackage", "${resolverPath}", + "-importPackage", "${jarresolver_package}", "-exportPackage", "Assets/GoogleMobileAds", "Assets/Plugins", @@ -102,4 +118,4 @@ task clearTempBuildFolder(type:Delete) { exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar, downloadResolver) -exportPackage.finalizedBy(clearTempBuildFolder, deleteResolver) +exportPackage.finalizedBy(clearTempBuildFolder) diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs index 7070f9806..330b8d008 100644 --- a/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs @@ -20,7 +20,7 @@ namespace GoogleMobileAds.Api { public class AdRequest { - public const string Version = "3.1.0"; + public const string Version = "3.1.1"; public const string TestDeviceSimulator = "SIMULATOR"; public class Builder diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs b/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs index cc42e8b56..91cfc790d 100644 --- a/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs +++ b/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs @@ -49,14 +49,6 @@ static void SetupDeps() { "extra-google-m2repository", "extra-android-m2repository"} } }); - - // Marshmallow permissions requires app-compat. - Google.VersionHandler.InvokeInstanceMethod( - svcSupport, "DependOn", - new object[] { "com.android.support", "appcompat-v7", "23.1.0+" }, - namedArgs: new Dictionary() { - {"packageIds", new string[] { "extra-android-m2repository" }}, - }); #elif UNITY_IOS Type iosResolver = Google.VersionHandler.FindClass( "Google.IOSResolver", "Google.IOSResolver"); @@ -67,7 +59,7 @@ static void SetupDeps() { iosResolver, "AddPod", new object[] { "Google-Mobile-Ads-SDK" }, namedArgs: new Dictionary() { - { "version", "7.8+" } + { "version", "7.13+" } }); #endif // UNITY_IOS }