Skip to content

Commit

Permalink
fixed gradle template errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Bella committed Jul 16, 2018
1 parent 4ed1ca4 commit cebaf38
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 21 deletions.
23 changes: 18 additions & 5 deletions Assets/Plugins/Android/libTemplate.gradle
@@ -1,23 +1,35 @@
buildscript {
repositories {
mavenCentral()
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
jcenter()
google()
} else {
jcenter()
}
}

dependencies {
// use newer version of the plugin for newer unity/gradle versions
if (gradle.gradleVersion.split('\\.').first().toInteger() < 4) {
if (GradleVersion.current() < GradleVersion.version("4.0")) {
classpath 'com.android.tools.build:gradle:2.1.0'
} else {
} else if (GradleVersion.current() < GradleVersion.version("4.2")) {
classpath 'com.android.tools.build:gradle:2.3.3'
} else {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
}

apply plugin: 'android-library'

dependencies {
compile fileTree(dir: 'bin', include: ['*.jar'])
compile fileTree(dir: 'libs', include: ['*.jar'])
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
implementation fileTree(dir: 'bin', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])
} else {
compile fileTree(dir: 'bin', include: ['*.jar'])
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}

android {
Expand All @@ -26,6 +38,7 @@ android {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}

Expand Down
80 changes: 64 additions & 16 deletions Assets/Plugins/Android/mainTemplate.gradle
@@ -1,47 +1,77 @@
buildscript {
repositories {
jcenter()
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
jcenter()
google()
} else {
jcenter()
}
}

dependencies {
// use newer version of the plugin for newer unity/gradle versions
if (gradle.gradleVersion.split('\\.').first().toInteger() < 4) {
if (GradleVersion.current() < GradleVersion.version("4.0")) {
classpath 'com.android.tools.build:gradle:2.1.0'
} else {
} else if (GradleVersion.current() < GradleVersion.version("4.2")) {
classpath 'com.android.tools.build:gradle:2.3.3'
} else {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
}

allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
repositories {
flatDir {
dirs 'libs'
}

if (GradleVersion.current() >= GradleVersion.version("4.2")) {
jcenter()
google()
} else {
jcenter()
}
}
}

apply plugin: 'com.android.application'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
implementation fileTree(dir: 'libs', include: ['*.jar'])
} else {
compile fileTree(dir: 'libs', include: ['*.jar'])
}

**DEPS**
**DEPS**
}

android {
// Fix complaint that 3rd party libraries (ours!) have the same package name
enforceUniquePackageName false
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'

if (GradleVersion.current() < GradleVersion.version("4.2")) {
// fix complaint that 3rd party libraries (ours!) have the same package name
enforceUniquePackageName false
}

defaultConfig {
applicationId '**APPLICATIONID**'

minSdkVersion 16
targetSdkVersion **TARGETSDKVERSION**

versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'

multiDexEnabled true

if (GradleVersion.current() >= GradleVersion.version("4.0")) {
ndk {
abiFilters **ABIFILTERS**
}
}
}

packagingOptions {
Expand All @@ -53,19 +83,37 @@ android {
abortOnError false
}

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

**SIGN**

buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
useProguard **PROGUARD_DEBUG**
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}

release {
// Set minifyEnabled to true if you want to run ProGuard on your project
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
minifyEnabled **MINIFY_RELEASE**
if (GradleVersion.current() >= GradleVersion.version("4.2")) {
useProguard **PROGUARD_RELEASE**
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**

**SIGNCONFIG**
}

**PACKAGING_OPTIONS**
**SPLITS**
**BUILT_APK_LOCATION**
}

**SPLITS_VERSION_CODE**
**SOURCE_BUILD_SETUP**
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Change Log

## [4.9.1](https://github.com/deltaDNA/unity-sdk/releases/tag/4.9.1) (YYYY-MM-DD)
### Fixed
- Gradle template not setting app version on Unity 2017.1+.
- Gradle template causing build error on Unity 2018.2.

## [4.9.0](https://github.com/deltaDNA/unity-sdk/releases/tag/4.9.0) (2018-05-21)
### Added
- API for forgetting the user and stopping tracking (GDPR).
Expand Down

0 comments on commit cebaf38

Please sign in to comment.