Dagger 2 with Java 8 error compilation - android

Dagger 2 don't work with java 8 and Jack enabled.Try to solve this problem with different versions of dagger 2.x Didn't help. Works fine before but when I try to add Java 8 this error occurred:
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.jack.ir.JNodeInternalError: java.lang.Exception: java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.whitespace()Lcom/google/common/base/CharMatcher;
App gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.test.my.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.dagger:dagger:2.5'
annotationProcessor "com.google.dagger:dagger-compiler:2.5"
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
Project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// 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
}

Charmatcher.whitespace() was introduced in Guava 19. Looks like you have some code that compiles against Guava 19, but end up with something earlier than that on the classpath.

Related

Android Studio Error Could not parse the Android Application Module's Gradle config

I am trying to setup firebase on my android-studio application but I get this error "Android Studio Error Could not parse the Android Application Module's Gradle config". I have tried tweaking versions removing jcenter() yet to no fix.
build.gradle project
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle module
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.easyactivity"
minSdk 21
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.3'
}
settings.gradle
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Easy Activity"
include ':app'

How to implement external fingerprint device SDK in android?

I am making a app which registers fingerprint of the employees for registration. However I am facing difficulty in implementing the external fingerprint device SDK in my app. I have imported it as module but the gradle keeps on giving me error on syncing and the sync fails with error message as:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project
Here is my gradle code:
For app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.employeeRegistration"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
repositories {
google()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
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(':readerUSBISO')
}
For 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
}
For Fingerprint sdk:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.fpdemo"
minSdkVersion 21
targetSdkVersion 27
}
buildTypes {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation files('libs/fgtitdevice.jar')
}
Help me with this situation.

Failed to sync gradle project after adding Mapbox navigation SDK package.Its showing some irrelavant error [duplicate]

This question already has answers here:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
Here is my gradle file. I am using Appcompat 25.3.1 version, but the error is on Appcompat 26.1.0. This error goes off when navigation SDK package is removed. I dont understand what is happening. Any help is greatly appreciated.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.aadhilahmed.test3"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories{
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.2' //error is here
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
And this is my error message:
Failed to resolve: com.android.support.appcompat-v7:26.1.0
Error:- Install repository and sync project.
Open file.
Show in Project Structure Dialog.
Even clicking on Install repository and sync project does absolutely nothing.
Add this inside your repositories block in your project level build.gradle file:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
This is the best way to do it.
In your root level gradle.build use below
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and in your gradle-wrapper.properties file change the wrapper version as below
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
also in your app level build.gradle make sure you are using 26 vesion as below
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
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'
}
}
}

TransformException while building a project

Following is my build.gradle file
buildscript {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.0'
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.abc.def"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
generatedDensities = []
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
def final APP_COMPAT_VERSION = "24.0.+"
dependencies {
compile "com.android.support:design:$APP_COMPAT_VERSION"
compile 'com.android.support:cardview-v7:23.3.+'
compile 'com.android.support:support-vector-drawable:23.3.+'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:palette-v7:25.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.rebound:rebound:0.3.8'
}
Im getting the following error when I run this project
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/text/BidiFormatter$1.class
I tried to build after cleaning the project. I tried to delete the build folder and rebuilt the project again but still Im getting this error. How can I be able to solve this out?
Use support libraries of the same version.
compile "com.android.support:design:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:support-vector-drawable:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:palette-v7:$APP_COMPAT_VERSION"

Retrolambda Error:Cannot get property 'destinationDir' on null object

I am trying to use retrolambda in my application but I face issues
build.gradle project
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle app
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "psystem.co.reaya"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:+'
compile 'com.android.support:multidex:1.0.1'
}
my tries to fix the issue remove jack options , I got this error `org.gradle.execution.TaskSelectionException: Task ',' not found in root project 'Reaya'.`
any one can help me to fix my issue
thank you
1.update the Android studio to 2.1 or higher version;
2.delete the "apply plugin: 'me.tatarka.retrolambda'"
Try it!
removing the lines apply plugin: 'me.tatarka.retrolambda' worked for me.
Might stick to retrolambda. Some discussions on jack can be found here

Categories

Resources