Got empty license reports with hierynomus' gradle license plugin - gradle

I'm making two android apps on a Gradle project and managing dependency licenses with Hierynomus' gradle license plugin.
Then, I executed following commands:
$ ./gradlew downloadLicenses
$ cat ./build/reports/license/dependency-license.json
But the generated license reports are empty.
{"dependencies":[]}
I tried to fix the problem with the documents below:
https://github.com/hierynomus/license-gradle-plugin/issues/81
https://github.com/hierynomus/license-gradle-plugin/issues/103
https://github.com/hierynomus/license-gradle-plugin/issues/137
https://github.com/hierynomus/license-gradle-plugin/issues/174
but I couldn't resolve the problem.
Next, I tried to execute the task with --refresh-dependencies and --rerun-tasks options. Sadly, the problem hadn't fixed.
Those are my build scripts:
// build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_coroutine_version = '1.1.1'
repositories {
google()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.12.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
}
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.hierynomus.license'
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'implementation'
ext.apacheTwo = license('Apache License, Version 2.0', 'https://opensource.org/licenses/Apache-2.0')
ext.bsd = license('BSD License', 'https://opensource.org/licenses/bsd-license')
aliases = [
(apacheTwo): [
'The Apache Software License, Version 2.0',
'Apache 2',
'Apache License Version 2.0',
'Apache License, Version 2.0',
'Apache License 2.0',
license('Apache License', 'https://www.apache.org/licenses/LICENSE-2.0')
],
(bsd): [
'BSD',
license('New BSD License', 'https://opensource.org/licenses/bsd-license')
]
]
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.console"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
lintConfig file("lint.xml")
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
// client/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.client"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps:google-maps-services:0.9.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'org.jetbrains.spek:spek-api:1.1.5'
testImplementation 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testImplementation 'org.mockito:mockito-core:+'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.platform:junit-platform-runner:1.1.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
No doubt I expected dependencies license reports of my project were generated under ${PROJECT_ROOT}/build/reports/license/. I found the reports are generated, however, those were empty.
Thanks!

It seems to be a problem with version 0.15.0 Fix getting licenses on Android.
For me, it worked with version 0.14.0 and some additional configurations:
// buil.gradle root
plugins {
id "com.github.hierynomus.license" version "0.14.0"
}
downloadLicenses {
dependencyConfiguration = 'implementation'
includeProjectDependencies = true
}
// build.gradle app
apply plugin: 'com.github.hierynomus.license'
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)

Related

unresolved reference: github (cant import to my class)

I tried to download a library. But I think i did something wrong in my build.gradle Project. Because when I try to import the library manually, I get this error:
My Project Gradle File
buildscript {
repositories {
google()
maven {url 'https://jitpack.io'}
}
dependencies {
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3")
}
}
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App Gradle File
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.ahmetkaan.kediy"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
//...
implementation 'com.github.onecode369:WYSIWYG:4.0'
}
The library says me to add " maven {url 'https://jitpack.io'} " this to my project gradle and " implementation 'com.github.onecode369:WYSIWYG:4.0' " this to my app gradle. I think there is a problem in the project gradle's repositories (maven). Because the library says to me add like this;
allprojects {
repositories {
...
maven {url 'https://jitpack.io' }
}
}
But I can't add allprojects on top of repositories. I am getting an error like:
A problem occurred evaluating root project 'Kediy'.
> Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'
What should I do?

Build failed - Could not find androidx.lifecycle:compiler:2.2.0

I am totally new to Android and struggling past 2days with my build.
I get the following message
Build failed
Could not find androidx.lifecycle:compiler:2.2.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/lifecycle/compiler/2.2.0/compiler-2.2.0.pom
- https://jcenter.bintray.com/androidx/lifecycle/compiler/2.2.0/compiler-2.2.0.pom
Required by: project :app
I updated my studio and gradle plugins and versions of dependencies, but none seem to work. I am using Gradle Plugin: 4.0.1 and Gradle: 6.1.1
My project gradle is as follows
buildscript {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xxxx.xxxxxx"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
def room_version = "2.2.0"
def lifecycle_version = "2.2.0"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// Annotation processor
annotationProcessor "androidx.lifecycle:compiler:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
}
In the idea.log i find the line
testKnownPluginVersionProvider - 'gradle' plugin missing from the offline Maven repo, will use default 4.0.1
repeating regularly and the gradle-wrapper properties file is as follows
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Remove the following line if you are using Java 8:
annotationProcessor "androidx.lifecycle:compiler:$lifecycle_version"

NoClassDefFoundError: error when generating apk

migrate my application to android x and gradle 5
the moment that I send to generate the apk or to install gives me this error
Caused by: java.lang.NoClassDefFoundError: com/android/tools/r8/dex/ApplicationReader
Build.graddle
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'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "gortiz.com.goapp"
minSdkVersion 18
targetSdkVersion 28
versionCode 37
versionName '2.0.37'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
implementation 'androidx.appcompat:appcompat:1.+'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.+'
implementation 'androidx.mediarouter:mediarouter:1.+'
implementation 'androidx.core:core:1.+'
implementation 'androidx.multidex:multidex:2.+'
implementation 'com.google.android.material:material:1.+'
implementation 'commons-io:commons-io:2.5'
implementation 'androidx.constraintlayout:constraintlayout:1.+'
implementation 'androidx.legacy:legacy-support-v4:1.+'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.github.satyan:sugar:1.5'
implementation 'com.squareup.picasso:picasso:2.5.0'
implementation 'me.panavtec:wizard:1.2'
implementation 'com.github.johnkil.print:print:1.2.+'
implementation 'com.github.bmelnychuk:atv:1.2.+'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
testImplementation 'junit:junit:4.12'
implementation 'androidx.recyclerview:recyclerview:1.+'
implementation ('com.google.firebase:firebase-messaging:17.3.4'){
exclude group: 'com.google.firebase', module: 'firebase-iid'
}
implementation 'com.google.android.gms:play-services-maps:17.+'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.android.gms:play-services-vision:18.+'
implementation 'com.google.firebase:firebase-config:18.+'
implementation 'com.google.firebase:firebase-iid:17.0.2'
implementation 'androidx.annotation:annotation:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
graddle.properties
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
Caused by: java.lang.NoClassDefFoundError: com/android/tools/r8/dex/ApplicationReader
The top level build.gradle seems to be missing a dependency on Android Gradle Plugin. Please add something like this (depending on the version you would like to use):
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
...
}
...
}
If you create an empty project in Android Studio that should all be in place.

Unable to resolve dependency for ':app#debugUnitTest/compileClasspath', :app#debugAndroidTest/compileClasspath

Situation:
Create the simplest project
Add to the project module as File -> New -> New module "Phone & Tablet Module"
Add the dependency on the module
And get errors:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve project :testmodule.
Below are the project files:
Project:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module: app
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.pawga.test00"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(path: ':testmodule')
}
Module: testmodule
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.pawga.testmodule"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
gradle-wrapper.properties
#Mon Jun 25 22:51:52 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
settings.gradle
include ':app', ':testmodule'
Note:
If the module type is "Android Library" (Point "two" above), then there are no such errors.
For such a simple project, where everything is by default, there should not be such errors. What's wrong?
Try this, replace:
implementation project(':testmodule')
To:
implementation project(path:':testmodule', configuration: 'default')
Go to
File -> Settings -> Build, Execution, Deployment -> Gradle menu.
You will see "Offline work" options. Uncheck it. And it's ok.
It looks like your plugin needs to be changed to apply plugin: 'com.android.library' instead of 'com.android.application'
See this post for more
information. Hope that helps.
Try online mode for gradle. Hope it helps(I had the same problem, so more chances).
##REMOVE THE FOLLOWING FROM THE BUILD GRADLE##
>>implementation 'com.android.support:appcompat-v7:28.+'
>>implementation 'com.android.support.constraint:constraint-layout:1.0.2'
>>androidTestImplementation 'com.android.support.test:runner:1.0.1'
>>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
>>SEE ATTACHED PICTURE
>>[STUDIO ERRORS][1]
>>[1]: https://i.stack.imgur.com/DY6sz.png

Error with java8 and Kotlin

I have an app where I'm using retrolambda so in the build.gradle I have
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Everything is fine unless I add the support for Kotlin.
Adding the Kotlin plugin I get the following error:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
I have found many questions and answers similar to this one but non of the solutions apply in my case.
This is my build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
// Required because retrolambda is on maven central
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'kotlin-android'
plugins {
id "me.tatarka.retrolambda" version "3.3.1"
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileOptions.incremental = false
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
multiDexEnabled true
applicationId "mypackage"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "0.1"
vectorDrawables.useSupportLibrary = true
jackOptions {
enabled false
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
compileOptions {
incremental true
}
buildTypes {
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
renderscriptDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
minifyEnabled false
versionNameSuffix "_dev"
}
}
}
def supportVersion = '25.3.1'
dependencies {
def daggerVer = 2.8
apt "com.google.dagger:dagger-compiler:$daggerVer"
compile "com.google.dagger:dagger:$daggerVer"
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:gridlayout-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile "com.android.support:preference-v7:$supportVersion"
compile "com.android.support:support-v4:$supportVersion"
compile "com.android.support:support-vector-drawable:$supportVersion"
compile "com.android.support:palette-v7:$supportVersion"
def firebase = '10.2.0'
compile "com.google.firebase:firebase-crash:$firebase"
compile "com.google.firebase:firebase-auth:$firebase"
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
def rxbinding = '2.0.0'
compile "com.jakewharton.rxbinding2:rxbinding:$rxbinding"
compile "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbinding"
compile "com.jakewharton.rxbinding2:rxbinding-appcompat-v7:$rxbinding"
compile "com.jakewharton.rxbinding2:rxbinding-design:$rxbinding"
compile "com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:$rxbinding"
compile "com.jakewharton.rxbinding2:rxbinding-leanback-v17:$rxbinding"
compile 'joda-time:joda-time:2.5'
compile 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.clans:fab:1.6.4'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.github.paolorotolo:appintro:4.1.0'
//architecture
compile "android.arch.lifecycle:runtime:1.0.0-alpha1"
compile "android.arch.lifecycle:extensions:1.0.0-alpha1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"
def retrofit2 = '2.2.0'
def okhttp3 = '3.4.1'
compile "com.squareup.retrofit2:retrofit:$retrofit2"
compile "com.squareup.retrofit2:adapter-rxjava2:$retrofit2"
compile "com.squareup.retrofit2:converter-gson:$retrofit2"
compile "com.squareup.retrofit2:converter-scalars:$retrofit2"
compile "com.squareup.okhttp3:okhttp:$okhttp3"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp3"
compile 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
compile 'com.github.MFlisar:RxBus2:0.1'
def butter_knife = '8.4.0'
apt "com.jakewharton:butterknife-compiler:$butter_knife"
compile "com.jakewharton:butterknife:$butter_knife"
def leak_canary = '1.4'
debugCompile "com.squareup.leakcanary:leakcanary-android:$leak_canary"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
apt 'com.gabrielittner.auto.value:auto-value-with:1.0.0'
apt 'com.google.auto.value:auto-value:1.2'
apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-gson:0.3.2-rc1'
provided 'javax.annotation:jsr250-api:1.0'
provided 'com.google.auto.value:auto-value:1.2'
compile 'com.braintreepayments.api:drop-in:3.0.6'
//other dependencies for testing
def hamcrestVersion = '1.3'
testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.jetbrains:annotations:15.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
android.packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/rxjava.properties'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion "$supportVersion"
}
}
}
}
With no success I tried this
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
kotlinOptions {
jvmTarget = '1.6'
apiVersion = '1.1'
languageVersion = '1.1'
}
}
and this
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = '1.8'
apiVersion = '1.1'
languageVersion = '1.1'
}
}
Update
with the last version that uses 1.8 for kotlin I now get a different error:
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
I'm investigating now
This is my top level build.gradle
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:2.3.0') {
force = true
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle file
classpath 'com.google.gms:google-services:3.0.0'
classpath "io.realm:realm-gradle-plugin:2.1.1"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Retrolambda is not processing the Kotlin bytecode, and you should set the Kotlin compiler to specifically target 1.6 bytecode. This will not break anything in current version of Kotlin as it can generate the older bytecode for the same functionality.
compileKotlin {
kotlinOptions.jvmTarget = "1.6"
}
This is documented in the Kotlin Gradle Plugin attributes
For tests, also add:
compileTestKotlin {
kotlinOptions.jvmTarget = "1.6"
}

Resources