Hello guys I desire to use lamba functions available on Java8, hence I had to apply new toolchain Jack. Unfortunatelly when I did some unexpected error arise. Namely:
Could not get unknown property 'classpath' for task ':app:transformJackWithJackForProdDebug' of type com.android.build.gradle.internal.pipeline.TransformTask. I'm using in my project library like
In project I'm using lib like:
I know that dagger causes error, however since july dagger2 has became available to use.
I use
Please look at my gradle
project/buidl.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
// classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId "XXX"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
jackOptions{
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
versionNameSuffix "_debug"
}
}
productFlavors{
dev{
minSdkVersion 21
}
prod {
minSdkVersion 19
}
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
ext {
JUNIT_VERSION = '4.12'
DAGGER_VERSION = '2.4'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile "junit:junit:$JUNIT_VERSION"
compile project(path: ':android_mvp')
// dependency injection
apt 'com.google.dagger:dagger-compiler:2.0' // 2.5 causes error
compile 'com.google.dagger:dagger:2.0'
provided 'javax.annotation:jsr250-api:1.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
// for new Jack and Jill gradle 2.2.+
// rx java
compile 'io.reactivex:rxjava:1.1.6'
compile 'io.reactivex:rxandroid:1.2.1'
// RxAndroid providing Android Scheduler
compile 'io.reactivex:rxjava-joins:0.22.0'
// view
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
// rest / stream
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.neovisionaries:nv-websocket-client:1.29'
// time
compile 'net.danlew:android.joda:2.9.3'
}
EDITED
apply plugin: 'com.neenbedankt.android-apt'
...
dependency{
apt 'com.google.dagger:dagger-compiler:2.0' // 2.5 causes error
}
CONCLUSION
After 2,5 years after first j8 release lazy Android team is not able to integrate it. 2,5 year in IT is sooo long, so my programing skils became slowly deprecated! I hope they finish until j9 release!
Had the same issue. Solved by using built in "annotationProcessor" instead of "apt" plugin
https://stackoverflow.com/a/39086683/2282051
remove:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
apply plugin: 'com.neenbedankt.android-apt'
apt 'com.google.dagger:dagger-compiler:2.0'
and you already have
dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}
It does the same as the 'apt' plugin does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With