unity-jar-resolver
                                
                                 unity-jar-resolver copied to clipboard
                                
                                    unity-jar-resolver copied to clipboard
                            
                            
                            
                        Limit upper bounds of com.android.support to compileSdkVersion
Issue
This resolver plugin should limit the upper bounds of all modules under the com.android.support group to match compileSdkVersion. Example if com.android.support revision 26 is used when Unity uses compileSdkVersion of 25 the following build error occurs.
Example Error 1
com.android.support = 26
compileSdkVersion = 25
CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java
   -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar"
   org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m"
   "assembleRelease"
stderr[
   UnityProjectDir/Temp/gradleOut/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54:
      AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.    
   UnityProjectDir/Temp/gradleOut/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:
      error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Example Error 2
com.android.support = 27.1.1
compileSdkVersion = 25
CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
stderr[
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontWeight
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Reproducing Issue
This is reproducible by using the following:
- Unity 2017.4.0f1(Exact version probably not needed)
- File>- Build Settings..>- Player Settings...>- Target API Level- Android 7.1 'Nougat' (API Level 25)Or lower
 
- play-services-resolver-1.2.64.0.unitypackage
- OneSignalSDK.unitypackage - version 2.6.4or any- *Dependencies.xmlfile like OneSignal's
Work Arounds
Option 1
- Updated version of Unity
- Tested with Unity 2017.4.0f1, might work on older versions
 
- Tested with 
- Update to latest Android SDK
- Platform-Tools 27+
- Build Tools 27+ (Without 28.0.0-rc1)
 
- File>- Build Settings..>- Player Settings...>- Target API Level- Set as Automatic (highest installed)
 
- Set as 
Option 2
- Steps 1 & 2 from Option 1
- File>- Build Settings..- Set "Build System" to Gradle
- Check "Export Project"
 
- Open app/build.gradleupdatecompileSdkVersionto 27.
Option 3
- Search for *Dependencies.xmlfiles in your project
- Find lines that contain <androidPackage spec="com.android.support:- such as OneSignal/Dependencies.xml#L5
 
- Update the version to match what you have in
File>Build Settings..>Player Settings...>Target API Level
- WARNING: Forcing a lower version may here have side effects such as runtime issues on the library depending on what features it uses
@jkasten2 does this jive with what the support library team is suggesting here https://developer.android.com/topic/libraries/support-library/index.html#api-versions ?
If we want to apply special logic around a dependency like this perhaps somewhere this could be applied is in https://github.com/googlesamples/unity-jar-resolver/blob/master/source/PlayServicesResolver/scripts/download_artifacts.gradle ?
@stewartmiles The link talks about minimum API level, it doesn't bring up the compile SDK version though. Actually wasn't able to find a reference to the specific limitation of compileSdkVersion and com.android.support in any of the Google docs online docs. However this error is shown in Android Studio:

It notes 'different' but I don't believe there will be an issue with the compileSdkVersion being greater than com.android.support. Only when compileSdkVersion is less than com.android.support as it's can refer to classes or resource names that isn't in the compile version referenced.
I might have so time to dig into this in the next week or 2. I see there is also a nice quick and easy to run test for this file ./gradlew test_downloadArtifacts that runs for me.
I am having some trouble with a full build however running ./gradlew build --info. I'll open a 2nd issue for this with more detail though, to keep this issue on a single topic.
+1 on this, as it has been making my life hell the past few days.
Fyi @jkasten2 there is a 4th option, which is to create mainTemplate.gradle from Player Settings and override compileSdkVersion there instead of having to export!