Importing this project from github, I've run into this message:
Gradle 'GameOfLife-master' project refresh failed
Error:Cause: org/gradle/internal/TrueTimeProvider
I've tried solutions posted here, cleaned/rebuilt (at least attempted to) the project, invalidated caches and tried a different version of Gradle. None of that worked. Anyone else got any ideas?
Module: app - build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "com.neenbedankt.gradle.plugins:android-apt:1.8"
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.5.+"
classpath 'io.fabric.tools:gradle:1.+'
classpath 'hu.supercluster:paperwork-plugin:1.2.7'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
apply plugin: 'hugo'
apply plugin: "build-time-tracker"
apply plugin: 'hu.supercluster.paperwork'
paperwork {
set = [
gitInfo: gitInfo(),
gitSha: gitSha(),
buildTime: buildTime("yyyy-MM-dd HH:mm:ss", "GMT+01:00")
]
}
def versionMajor = 1
def versionMinor = 2
def versionPatch = 0
android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
defaultConfig {
applicationId 'hu.supercluster.gameoflife'
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
signingConfigs {
alpha {}
beta {}
release {}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
resValue "string", "app_name_for_buildtype", "Game of Life (debug)"
minifyEnabled false
testCoverageEnabled = false
}
alpha {
applicationIdSuffix ".alpha"
versionNameSuffix "-alpha"
resValue "string", "app_name_for_buildtype", "Game of Life (alpha)"
minifyEnabled false
testCoverageEnabled = false
lintOptions {
disable 'MissingTranslation'
}
}
beta {
applicationIdSuffix ".beta"
versionNameSuffix "-beta"
resValue "string", "app_name_for_buildtype", "Game of Life (beta)"
minifyEnabled false
testCoverageEnabled = false
}
release {
resValue "string", "app_name_for_buildtype", "Game of Life"
minifyEnabled false
proguardFile 'proguard-project.txt'
}
}
sourceSets.main {
// src/gen is the target for generated content like json model
java.srcDirs += 'build/generated/source/db'
}
// avoid errors with message 'Duplicate files copied in APK ...'
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
afterEvaluate {
def propsFile = rootProject.file('keystore.properties')
def configName = 'release'
if (propsFile.exists() && android.signingConfigs.hasProperty(configName)) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
android.signingConfigs[configName].storeFile = rootProject.file(props['storeFile'])
android.signingConfigs[configName].storePassword = props['storePassword']
android.signingConfigs[configName].keyAlias = props['keyAlias']
android.signingConfigs[configName].keyPassword = props['keyPassword']
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-annotations:24.2.0'
compile 'com.android.support:support-v13:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
// ---------
compile 'com.github.tslamic.adn:library:1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') { transitive = true }
compile 'com.jakewharton.timber:timber:2.5.1'
compile 'com.squareup:otto:1.3.6'
compile 'hu.supercluster:paperwork:1.2.7'
// ---------
apt "org.androidannotations:androidannotations:" + androidAnnotationsVersion
compile("org.androidannotations:androidannotations-api:" + androidAnnotationsAPIVersion )
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile('com.squareup:fest-android:1.0.+') { exclude module: 'support-v4' }
testCompile "org.robolectric:robolectric:3.0"
androidTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-library:1.1',
'com.jakewharton.espresso:espresso:1.1-r3'
}
apt {
arguments {
resourcePackageName android.defaultConfig.applicationId
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
apply plugin: 'idea'
idea {
module {
//and some extra test source dirs
testSourceDirs += file('src/test')
}
}
apply from: 'build-time-tracker.gradle'
You could run with --stacktrace to get a full exception stack trace
Gradle has the concept of public API and private API. Basically anything in org.gradle.internal is a part of the private API and the gradle team can change / remove these classes between gradle versions. Ideally plugins should never reference internal classes. Any plugin author referencing internal API's must understand that this code may break with a new release of Gradle.
It looks like one of your plugins is referencing the internal API (org.gradle.internal.TrueTimeProvider) and the plugin was built against one version of Gradle and you are running with a different version of gradle.
To fix, you'll need to determine which plugin is throwing the exception (--stacktrace will help here). Then you'll either need to change the plugin version to one compatible with your version of gradle, or change the gradle version you are running with.
Related
I have an app already published on the store, after upgrading to Android Studio 3 (now 3.1) and the forced update of gradle I am unable to import my external projects as modules.
I have tried removing all my modules and adding them one by one, deleting the cache, changing gradle version, and compileSdkVersion but it doesn't work.
When I try to sync gradle I receive some messages like this:
Unable to resolve dependency for ':app#produzioneDebug/compileClasspath': Failed to transform file 'ShareLib-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
This is in my settings.gradle to make external project available:
include ':app'
include ':ShareLib'
project(':ShareLib').projectDir = new File('..//ShareLib//')
This is my build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven {
url 'https://repo.spring.io/libs-milestone'
}
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def AAVersion = '4.4.0'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.0.0"
applicationId "com.xxx.app"
// Enabling multidex support.
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": android.defaultConfig.applicationId]
}
}
}
signingConfigs {
releaseSigning {
///
}
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
release {
// proguard
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources false
zipAlignEnabled true
signingConfig signingConfigs.releaseSigning
}
}
flavorDimensions "tier"
productFlavors {
dev {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "development.xxx.app"
}
coll {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "test.xxx.app"
}
prod {
buildConfigField "String", "SERVICE_URL_BASE", "\"www.xxx.com/xxx-rest\""
applicationId "com.xxx.app"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(path: ':shareLib', configuration: 'default')
// implementation project(path: ':shareLib', configuration: 'default') {
// exclude module: 'jsr305'
// }
// compile fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.squareup:otto:1.3.8'
implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
annotationProcessor "org.androidannotations:rest-spring:$AAVersion"
implementation "org.androidannotations:rest-spring-api:$AAVersion"
annotationProcessor "org.androidannotations:otto:$AAVersion"
implementation "org.androidannotations:otto:$AAVersion"
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
// support AA on Android < 5
// compile 'com.android.support:multidex:1.0.1'
implementation 'com.github.markomilos:paginate:0.5.1'
// mpandroid
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
// crashlytics fabric
implementation('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true
}
// recaptcha
implementation ('android.lib.recaptcha:reCAPTCHA:2.0.0') {
exclude group: 'com.android.support'
}
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
}
I have solved opening modules project one by one and doing this for each one:
Project Structure -> Project -> Gradle Version = 4.7
Settings -> Build, Execution, Deployment -> Compiler -> Uncheck "Configure on demand"
Rebuild project once you can see your .aar file into build/outputs/aar
Then repeat these steps for main project module
As per this answer and this answer I already make changes in app gradle but still it is showing me following error while building my application.
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
What am I missing here?
Here is my App Gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
//project.ext.versionInfo.releaseVersionName = SYNCED_VERSION_NAME
android {
compileSdkVersion 23
flavorDimensions "default"
defaultConfig {
applicationId "in.something"
minSdkVersion 15
targetSdkVersion 23
versionCode 13
versionName "1.10"
multiDexEnabled true
}
productFlavors {
LIVE_BETA {
applicationIdSuffix ".beta"
resValue "string", "app_display_name", "Something(B)"
resValue "string", "SERVER_URL", "http://something/beta"
}
LIVE {
resValue "string", "app_display_name", "something"
resValue "string", "SERVER_URL", "http://something/live"
}
DEV {
applicationIdSuffix ".dev"
resValue "string", "app_display_name", "something(D)"
resValue "string", "SERVER_URL", "http://localhost/"
}
}
buildTypes {
debug {
// applicationIdSuffix "
// .debug"
// versionNameSuffix "-debug"
}
release {
//minifyEnabled true
//shrinkResources true
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
// Rename APK files
// applicationVariants.all { variant ->
// def output = variant.outputs.get(0)
// File apk = output.outputFile
// String newName = output.outputFile.name.replace(".apk", "-${variant.mergedFlavor.versionCode}-${variant.mergedFlavor.versionName}-.apk")
// .replace("app-", "${variant.mergedFlavor.applicationId}-")
// output.outputFile = new File(apk.parentFile, newName)
// }
}
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//================== Local ========================/
implementation fileTree(include: ['*.jar'], dir: 'libs')
//compile files('libs/ksoap2-android-assembly-3.1.1-jar-with-dependencies.jar')
/** *************************************************/
//================== Default ========================/
implementation 'com.android.support:appcompat-v7:23.1.0'
implementation 'com.android.support:recyclerview-v7:23.1.0'
implementation 'com.android.support:design:23.1.0'
implementation 'com.android.support:cardview-v7:23.1.0'
/** *************************************************/
implementation 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.6.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.6.3'
//implementation files('libs/bouncycastle-java5-136-1.0.0.jar')
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
/************ Location *****************/
implementation 'com.google.android.gms:play-services-location:8.3.0'
/** *************************************************/
/************ Common *****************/
implementation 'commons-io:commons-io:2.4'
implementation 'commons-codec:commons-codec:1.4'
/** ********************************/
implementation('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
implementation files('libs/bouncycastle-java5-136-1.0.0.jar')
}
I am using Android Studio 3.0 and gradle version is 3.0
And add below your
classpath 'io.fabric.tools:gradle:1.+'
definition
classpath "io.realm:realm-gradle-plugin:4.1.1"
For me it looks like it was upgrading Realm from
classpath "io.realm:realm-gradle-plugin:1.0.0"
to
classpath "io.realm:realm-gradle-plugin:4.1.1"
I have project in Kotlin and I have updated Android Studio to 2.3.3 and gradle to 3.3 and build tools to 25.3.1. During building I got this error:
Caused by: java.lang.UnsupportedOperationException: The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed.
at com.android.SdkConstants.androidCmdName(SdkConstants.java:1947)
at com.android.SdkConstants$androidCmdName$0.callStatic(Unknown Source)
at com.jakewharton.sdkmanager.internal.AndroidCommand$Real.<init>(AndroidCommand.groovy:21)
at com.jakewharton.sdkmanager.internal.PackageResolver.resolve(PackageResolver.groovy:22)
at com.jakewharton.sdkmanager.internal.PackageResolver$resolve.call(Unknown Source)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy:44)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy)
at com.jakewharton.sdkmanager.SdkManagerPlugin.time(SdkManagerPlugin.groovy:51)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2.doCall(SdkManagerPlugin.groovy:43)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
... 56 more
Gralde file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.github.JakeWharton:sdk-manager-plugin:master'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
task increaseBuildStageVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING STAGE VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_STAGE'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_STAGE'].toInteger() + value
versionPropsI['VERSION_BUILD_STAGE'] = versionBuild.toString()
versionPropsI['VERSION_CODE_STAGE'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
task increaseBuildProductionVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING PRODUCTION VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_PRODUCTION'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_PRODUCTION'].toInteger() + value
versionPropsI['VERSION_BUILD_PRODUCTION'] = versionBuild.toString()
versionPropsI['VERSION_CODE_PRODUCTION'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'packageStageRelease') {
task.dependsOn increaseBuildStageVersion
} else if (task.name == 'packageProductionRelease') {
task.dependsOn increaseBuildProductionVersion
}
}
android {
signingConfigs {
release {
.....
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.fivedottwelve.bonusapp"
minSdkVersion 19
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.release
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new GregorianCalendar().format("dd-MM-yyyy' 'h:mm:ss a Z")
buildConfigField "String", "GIT_SHA", "\"{$gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"{$buildTime}\""
}
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
buildConfigField "String", "GIT_SHA", "\"DEBUG\""
buildConfigField "String", "BUILD_TIME", "\"BUILD_TIME\""
}
}
productFlavors {
development {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
stage {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
production {
versionName "1.0." + getProdVersionName()
versionCode getProdVersionCode()
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
}
dexOptions {
preDexLibraries true
maxProcessCount 6
javaMaxHeapSize "3g"
}
testOptions {
unitTests.all {
// All the usual Gradle options.
testLogging {
jvmArgs '-XX:MaxPermSize=256m'
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
lintOptions {
disable 'InvalidPackage', 'ContentDescription'
abortOnError false
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
packagingOptions {
exclude 'main/AndroidManifest.xml'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'LICENSE.txt'
exclude 'LICENSE'
}
}
kapt {
generateStubs = true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
compile "com.android.support:support-v4:$rootProject.ext.android_support_version"
compile "com.android.support:appcompat-v7:$rootProject.ext.android_support_version"
compile "com.android.support:design:$rootProject.ext.android_support_version"
compile "com.android.support:recyclerview-v7:$rootProject.ext.android_support_version"
compile "com.android.support:cardview-v7:$rootProject.ext.android_support_version"
compile 'com.android.support:multidex:1.0.1'
compile "com.google.android.gms:play-services-base:$rootProject.ext.play_service_version"
compile "com.google.android.gms:play-services-gcm:$rootProject.ext.play_service_version"
kapt "com.google.dagger:dagger-compiler:$rootProject.ext.Dagger_version"
compile "com.google.dagger:dagger:$rootProject.ext.Dagger_version"
compile "io.reactivex:rxjava:$rootProject.ext.RxJava_version"
compile "io.reactivex:rxandroid:$rootProject.ext.RxAndroid_version"
provided 'javax.annotation:jsr250-api:1.0'
compile "com.squareup.okhttp3:okhttp:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:okhttp-urlconnection:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:logging-interceptor:$rootProject.ext.retrofit_http_version"
compile "com.squareup.retrofit2:retrofit:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:converter-gson:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$rootProject.ext.retorfit_version"
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
compile 'me.relex:circleindicator:1.2.1#aar'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
//transitions
compile "com.andkulikov:transitionseverywhere:1.7.0"
//beacons
compile "com.kontaktio:sdk:$rootProject.ext.kontakt_io"
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
}
repositories {
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url 'http://maven.livotovlabs.pro/content/groups/public' }
maven { url 'https://maven.fabric.io/public' }
}
/*
Resolves dependency versions across test and production APKs, specifically, transitive
dependencies. This is required since Espresso internally has a dependency on support-annotations.
*/
configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.ext.android_support_version"
}
/*
All direct/transitive dependencies shared between your test and production APKs need to be
excluded from the test APK! This is necessary because both APKs will contain the same classes. Not
excluding these dependencies from your test configuration will result in an dex pre-verifier error
at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497)
*/
configurations.compile.dependencies.each { compileDependency ->
println "Excluding compile dependency: ${compileDependency.getName()}"
configurations.androidTestCompile.dependencies.each { androidTestCompileDependency ->
configurations.androidTestCompile.exclude module: "${compileDependency.getName()}"
}
}
I removed apply plugin: 'android-sdk-manager' and it works
We have a gradle project that contains 4 modules: 1 library module and 3 android apps. To build our apps we use circleCI. We have also disabled predex-ing for the circleCI builds following this guide.
Everything was great until I added Instabug to one of our projects. We have been reaching the circleCI 4GB limit ever since. On top of that, the project that has Instabug as a dependency will start the preDex gradle task, no matter what. To start a new build, we use the following command: ./gradlew assembleDebug -PpreDexEnable=false.
The project that uses Instabug gets some warnings during build time like this:
Ignoring InnerClasses attribute for an anonymous inner class
(com.instabug.library.b) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is not an inner class.
I assume that we are reaching the 4 GB limit due to the preDex task that is started for the "Instabug project".
Does anyone has any idea on what's going on?
Edit : gradle files
root build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'de.hannesstruss:godot:0.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'de.hannesstruss.godot'
apply plugin: 'com.github.ben-manes.versions'
apply from: 'dependencies.gradle'
def ciServer = 'CI'
def executingOnCI = "true".equals(System.getenv(ciServer))
ext {
// preDexEnable property will come from the command line when circleCI is building the project.
if (project.hasProperty('preDexEnable')) {
project.ext.preDexLibs = project.properties['preDexEnable'].equals('true')
} else {
project.ext.preDexLibs = true // pre dexing should be true by default
}
buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
developmentFlavor = {
applicationId "${project.ext.appId}.${name}"
versionName "${project.ext.verName}-${name}"
minSdkVersion 15
buildConfigField "String", "API_TYPE", "\"${name}\""
resValue "string", "tray__authority", "${applicationId}.tray"
}
defaultLibraryFlavorConfig = {
targetSdkVersion 22
versionCode project.ext.verCode
versionName project.ext.verName
multiDexEnabled true
buildConfigField "String", "GIT_SHA", "\"${project.ext.gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
}
defaultFlavorConfig = defaultLibraryFlavorConfig << {
applicationId project.ext.appId
resValue "string", "tray__authority", "${applicationId}.tray"
}
defaultAndroidConfig = {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
javaMaxHeapSize executingOnCI ? "2048m" : "4g"
jumboMode true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
}
subprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
}
project.ext.gitSha = 'git rev-parse --short HEAD'.execute([], project.projectDir).text.trim()
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
dependencies.gradle
ext {
kiosk = [
dependencies: {
compile project(':common')
compile libraries.multidex
compile libraries.viewPagerIndicator
compile libraries.recyclerview
compile libraries.volley
compile libraries.instabug
compile libraries.mixpanel
compile libraries.loadToast
compile(libraries.crashlytics) {
transitive = true;
}
compile libraries.dagger
apt libraries.daggerCompiler
provided libraries.javaxAnnotations
}
]
}
kiosk module build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/repo' }
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://archiva.instabug.com/repository/release' }
maven { url "https://jitpack.io" }
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
ext.verCode = versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
ext.verName = "${versionMajor}.${versionMinor}.${versionPatch}"
ext.appId = 'care.smart.android.kiosk'
android defaultAndroidConfig << {
defaultConfig defaultFlavorConfig << {
minSdkVersion 21
buildConfigField "String", "APP_NAME", "\"Android-Kiosk\""
}
productFlavors {
realProduction {
buildConfigField "String", "API_TYPE", '"prod"'
}
// dev developmentFlavor
}
}
dependencies kiosk.dependencies
I have no real answer to this question. But the preDex task was created due to minSdkVersion 21. Also, we couldn't limit ourselves to 4GB of RAM so we had to bump it up to 6GB.
I've just updated my android gradle plugin from 0.12 to 0.13. Moreover I've downloaded gradle 2.1. Then, I tried with android studio 0.8.9 in beta but according http://tools.android.com/tech-docs/new-build-system/version-compatibility I have to use at least android studio 0.8.11 (canary channel). So I've updated my android studio but I have still the problem.
For now, I have to use gradle 1.10 and android gradle plugin 0.12.+ to work
Here the error from AS
Error:No such property: projectDependencies for class: com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated
Edit :
Here is my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
// works with 0.12.+ (not with 0.13.+)
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// The latest version of the android-apt plugin
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
}
}
allprojects {
repositories {
maven { // For Android-ViewPagerIndicator
url "http://dl.bintray.com/populov/maven"
}
jcenter()
mavenCentral()
maven {
url "http://JRAF.org/static/maven/2"
}
}
}
Here is my gradle-wrapper.properties
#Fri Sep 19 17:50:42 CEST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
# use gradle-2.1-all.zip with android gradle plugin 0.13
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
EDIT 2 :
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId 'xxx'
minSdkVersion 10
targetSdkVersion 19
versionCode xxx
versionName 'xxx'
}
// For more information see
// #link http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
debug {
storeFile file('../../KeyStore/debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('xxx')
storePassword 'xxx'
keyAlias 'xxx'
keyPassword 'xxx'
}
}
buildTypes {
// Just intern. This is alpha build
debug {
buildConfigField "boolean", "FORCE_GOOG_GEO_API", "false" // can be set to true in debug but not in other buildTypes
buildConfigField "boolean", "ENABLE_LOG", "true"
buildConfigField "String", "HOST", "\"xxx\""
versionNameSuffix '-alpha'
signingConfig signingConfigs.debug
zipAlign true
}
// For customer
recette {
buildConfigField "boolean", "FORCE_GOOG_GEO_API", "false"
buildConfigField "boolean", "ENABLE_LOG", "false"
buildConfigField "String", "HOST", "\"xxx\""
versionNameSuffix '-recette'
signingConfig signingConfigs.debug
zipAlign true
}
// PreProd
preprod {
buildConfigField "boolean", "FORCE_GOOG_GEO_API", "false"
buildConfigField "boolean", "ENABLE_LOG", "false"
buildConfigField "String", "HOST", "\"xxx\""
signingConfig signingConfigs.debug
zipAlign true
}
// Prod
release {
buildConfigField "boolean", "FORCE_GOOG_GEO_API", "false"
buildConfigField "boolean", "ENABLE_LOG", "false"
buildConfigField "String", "HOST", "\"xxx\""
signingConfig signingConfigs.release
zipAlign true
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
// This is important, it will run lint checks but won't abort build
lintOptions {
abortOnError false
disable 'MissingTranslation'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'AndroidManifest.xml'
}
}
apt {
arguments {
resourcePackageName android.defaultConfig.packageName
androidManifestFile variant.processResources.manifestFile
}
}
def GoogPlayServVersion = '5.0.+';
def GsonVersion = '2.2.4';
def LibPhoneNumbVersion = '5.9';
def GreenRobotVersion = '2.2.1';
def OkHttpVersion = '2.0.0';
def OkHttpConnVersion = '2.0.0';
def JacksonCore = '2.4.1';
def JacksonDatabind = '2.4.1';
def JacksonAnnotations = '2.4.0';
def SwitchVersion = '1.3.1';
def CroutonVersion = '1.8.4';
def ActionBarSherlockVersion = '4.4.0';
def ViewpagerIndicatorVersion = '2.4.1';
def PicassoVersion = '2.3.4';
def RoboSpiceVersion = '1.4.12';
def StickyListHeaders = '2.4.1';
def AAVersion = '3.1';
def RobotiumVersion = '5.2.1';
dependencies {
// Include all jar in libs folder
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google Play Services
compile "com.google.android.gms:play-services:$GoogPlayServVersion"
// Gson
compile "com.google.code.gson:gson:$GsonVersion"
// LibphoneNumber
compile "com.googlecode.libphonenumber:libphonenumber:$LibPhoneNumbVersion"
// GreenRobot
compile "de.greenrobot:eventbus:$GreenRobotVersion"
// OkHttp [We use repackaged version #see https://github.com/square/okhttp/issues/967]
// compile "com.squareup.okhttp:okhttp:$OkHttpVersion"
// compile "com.squareup.okhttp:okhttp-urlconnection:$OkHttpConnVersion"
// Jackson
compile "com.fasterxml.jackson.core:jackson-core:$JacksonCore"
compile "com.fasterxml.jackson.core:jackson-databind:$JacksonDatabind"
compile "com.fasterxml.jackson.core:jackson-annotations:$JacksonAnnotations"
// Switch backport
compile "org.jraf:android-switch-backport:$SwitchVersion"
// Crouton lib
compile("de.keyboardsurfer.android.widget:crouton:$CroutonVersion") {
// exclusion is not neccessary, but generally a good idea.
exclude group: 'com.google.android', module: 'support-v4'
}
// You must install or update the Support Repository through the SDK manager to use this dependency.
// The Support Repository (separate from the corresponding library) can be found in the Extras category.
// compile 'com.android.support:support-v4:19.1.0'
// compile 'com.android.support:gridlayout-v7:19.1.0'
// ActionBarSherlock
compile "com.actionbarsherlock:actionbarsherlock:$ActionBarSherlockVersion#aar"
// Android-ViewPagerIndicator
compile "com.viewpagerindicator:library:$ViewpagerIndicatorVersion#aar"
// Picasso
compile "com.squareup.picasso:picasso:$PicassoVersion"
// Robospice
compile "com.octo.android.robospice:robospice:$RoboSpiceVersion"
// StickyList headers
compile "se.emilsjolander:stickylistheaders:$StickyListHeaders"
// Facebook sdk
compile 'fr.avianey:facebook-android-api:+#aar'
// android annotations
compile "org.androidannotations:androidannotations-api:$AAVersion"
apt "org.androidannotations:androidannotations:$AAVersion"
compile 'com.sothree.slidinguppanel:library:+'
// Tests part
androidTestCompile "com.jayway.android.robotium:robotium-solo:$RobotiumVersion"
compile "com.jayway.android.robotium:robotium-solo:$RobotiumVersion"
}
Do you know how can I solve this ?
Thx
android-apt 1.3 doesn't seem to be compatible with v0.13 of the Android Gradle plugin. Please use android-apt 1.4 instead:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}