googlesamples / googlesamples/unity-jar-resolver
Limit upper bounds of com.android.support to compileSdkVersion
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 371
- Avg merge
- 14h 21m
- Merged PRs (30d)
- 3
Description
## 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`
```bash
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`
```bash
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 FontFamilyFont, unable to find attribute android:font
ERROR: In FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In 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:
1. `Unity 2017.4.0f1` (Exact version probably not needed)
2. `File` > `Build Settings..` > `Player Settings...` > `Target API Level`
- `Android 7.1 'Nougat' (API Level 25)` Or lower
3. [`play-services-resolver-1.2.64.0.unitypackage`](https://github.com/googlesamples/unity-jar-resolver/blob/e08830bcc2440ca240a1574644f4209ab2adc0c6/play-services-resolver-1.2.64.0.unitypackage)
4. [`OneSignalSDK.unitypackage - version 2.6.4`](https://github.com/OneSignal/OneSignal-Unity-SDK/blob/2.6.4/OneSignalSDK.unitypackage) or any [`*Dependencies.xml`](https://github.com/OneSignal/OneSignal-Unity-SDK/blob/2.6.4/OneSignalExample/Assets/OneSignal/Editor/OneSignalDependencies.xml) file like OneSignal's
## Work Arounds
### Option 1
1. Updated version of Unity
- Tested with `Unity 2017.4.0f1`, might work on older versions
2. Update to latest Android SDK
- Platform-Tools 27+
- Build Tools 27+ (Without 28.0.0-rc1)
3. `File` > `Build Settings..` > `Player Settings...` > `Target API Level`
- Set as `Automatic (highest installed)`
### Option 2
1. Steps 1 & 2 from Option 1
2. `File` > `Build Settings..`
- Set "Build System" to Gradle
- Check "Export Project"
3. Open `app/build.gradle` update `compileSdkVersion` to 27.
### Option 3
1. Search for `*Dependencies.xml` files in your project
2. Find lines that contain `
Contributor guide
Assessment
This issue has not been assessed yet.