Error: Annotation processors must be explicitly declared now - android-studio

I got an error in the execution of the app, how can I solve this?
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.0'
api 'com.google.firebase:firebase-messaging:11.8.0'
api 'com.google.android.gms:play-services-maps:11.8.0'
api 'com.google.android.gms:play-services-location:11.8.0'
implementation 'de.hdodenhof:circleimageview:2.0.0'
api 'com.android.support:design:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.android.support:cardview-v7:27.1.1'
api project(':mobicomkit')//Note: use this for customization
//api 'com.applozic.communication.message:mobicomkit:5.8.2'
implementation 'com.daprlabs.aaron:cardstack:0.3.1-beta0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support.constraint:constraintlayout:1.1.2'
compile 'ai.api:sdk:2.0.7#aar'
compile 'ai.api:libai:1.4.8'
}
I got the error below:
Annotation processors must be explicitly declared now. The following
dependencies on the compile classpath are found to contain annotation
processor. Please add them to the annotationProcessor configuration.
- log4j-core-2.2.jar (org.apache.logging.log4j:log4j-core:2.2)

Add the following line in dependencies.
annotationProcessor 'org.apache.logging.log4j:log4j-core:2.2'
For more information: enter link description here

Related

> No signature of method

I'm trying to build a handwritten digital classifier app but the build.gradle is not syncing so I am wondering what to do. I tried multiple options but unfortunately none have worked.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30
defaultConfig {
applicationId "org.tensorflow.lite.codelabs.digitclassifier"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// TODO: Add an option to avoid compressing TF Lite model file
aapOptions {
noCompress "tflite"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-androidb optimize.txt'), 'proguard-rules.pro'
}
}
}
// Sanity check if you have trained and downloaded TF Lite model.
preBuild.doFirst {
assert file("./src/main/assets/mnist.tflite").exists() :
"mnist.tflite not found. Make sure you have trained and " +
"downloaded your TensorFlow Lite model to assets/ folder"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Support Libraries
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// AndroidDraw Library
implementation 'com.github.divyanshub024:AndroidDraw:v0.1'
// Task API
implementation "com.google.android.gms:play-services-tasks:17.2.1"
//TODO: Add TF Lite
implementation 'org.tensorflow:tensorflow-lite:2.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Any help is appreciated. I have tried changing some of the SDK tools but that hasn't worked either. I don't know what I am going to do to make it sync up
You have a typo. aapOptions should be aaptOptions.
Also the proguardFiles has a problem and you'll get a more clear error message about it.

failed linking references - android studio

I'm getting the following error in my android studio project build
failed linking references,
error: resource id/edit_query (aka package:id/edit_query) not found.Message{kind=ERROR, text=error: resource id/edit_query (aka
package:id/edit_query) not found.,
sources=[C:\gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3482cd36ff1fc3489bd4ff1aeced93ab\res\values\values.xml:2689:5-2691:13],
original message=, tool name=Optional.of(AAPT)}
my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
my module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.weprcl.lathikashetty.weparcel"
minSdkVersion 16
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
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'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'org.parceler:parceler-api:1.1.11'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
annotationProcessor 'org.parceler:parceler:1.1.11'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:preference-v7:28.0.0'
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'
}
I tried every answer in the same issue questions but without benefit so any help will be appreciated
Thanks in advance
**

Dependencies using groupId com.android.support and androidx.* can not be combined

i synced my project, then i got those error, my manifest code is:
android {
compileSdkVersion 28
defaultConfig {
applicationId "chtaibi.yahya.footballcards"
minSdkVersion 15
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 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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 'com.google.android.gms:play-services-ads:18.1.1'
}
Can you help me please?
***** It looks like your post is mostly code; please add some more details.
You can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
AndroidX replaces the original support library APIs with packages in
the androidx namespace. Only the package and Maven artifact names
changed; class, method, and field names did not change.
Upgrade version
compileSdkVersion 29
defaultConfig {
targetSdkVersion 29
buildToolsVersion '29.0.2'
}
Your dependencies will
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Cannot fit requested classes in a single dex file. Try supplying a main-dex list

As per title, getting limit hit after upgrading AndroidStudio from 3.0.1 to 3.1,
no issue before.
Detail of the error:
methods: 66320 > 65536
Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
methods: 66320 > 65536, sources=[Unknown source file], tool name=Optional.of(D8)}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
multiDexEnabled false
applicationId "com.example.xxx"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
//minifyEnabled true
useProguard true
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
//minifyEnabled true
useProguard true
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
// Necessary to force the use of a specific version (on all the builds)
configurations.all {
resolutionStrategy.force 'com.github.bumptech.glide:glide:3.7.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Android
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:24.0.0'
implementation 'com.android.support:percent:27.0.2'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
//compile 'com.google.android.gms:play-services-auth:11.8.0'
// Firebase
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-appindexing:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-analytics:11.8.0'
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
implementation 'com.firebaseui:firebase-ui-database:0.4.1'
implementation 'com.firebaseui:firebase-ui-firestore:3.1.3'
implementation 'com.firebaseui:firebase-ui-storage:3.1.3'
implementation 'pub.devrel:easypermissions:1.1.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.2'
implementation group: 'com.github.bumptech.glide', name: 'glide', version: '3.7.0'
implementation 'com.firebase:geofire-android:2.2.0'
implementation 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
implementation 'me.himanshusoni.chatmessageview:chat-message-view:1.0.3'
implementation 'com.microsoft.projectoxford:face:1.3.0'
implementation 'com.google.ar:core:1.0.0'
implementation 'de.javagl:obj:0.2.1'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:27.0.2'
}
apply plugin: 'com.google.gms.google-services'
Try add
defaultConfig {
multiDexEnabled true
...
}
in gradle. It fix my problem.
documentation: https://developer.android.com/studio/build/multidex
Issue resolved.
Error was in some png aapt was trying to compress and found not correct.
Added
aaptOptions{
cruncherEnabled = false
}
in gradle solved the issue.
Hope this can help someone in the future.
delete -rf you used gradle version filepath(.gradle/warpper/dists/gradle-**.-all).
it fix my problem
Adding in the build.gradle file from app level:
defaultConfig {
multiDexEnabled true
...
}
Add implementation com.android.support:multidex:1.0.3 into the Gradle build, then multiDexEnabled true in defaultConfig.
Add dependency in build.gradle file:
implementation 'com.android.support:multidex:1.0.3'
In build.gradle's defaultConfig section, add:
multiDexEnabled true

Duplicate zip entry [classes.jar:android/support/test/filters/RequiresDevice.class]))

This issue is ligtly connected with the others that i started here:
Instrumentation run failed due to 'java.lang.NoClassDefFoundError' after adding multidex to my application
Unable to merge dex - how to exclude proper jar?
I added multidex support, then also added suport for tests.
I also added exlude to my packagingOptions, but it is not working as i thought.
Here is my build.gradle now:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
packagingOptions {
exclude 'protobuf.meta'
exclude 'android/support/test/filters/RequiresDevice.class'
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
sourceSets {
test.java.srcDirs += ['build/generated/source/apt/test/debug']
}
defaultConfig {
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext.daggerVersion = '2.11'
ext.roomVersion = '1.0.0-rc1'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7: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:2.0') {
exclude group: 'javax.inject'
}
testImplementation "org.robolectric:robolectric:3.4.2"
kaptTest "com.google.dagger:dagger-compiler:$daggerVersion"
kaptAndroidTest "com.google.dagger:dagger-compiler:$daggerVersion"
// RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Room
implementation "android.arch.persistence.room:runtime:$roomVersion"
implementation "android.arch.persistence.room:rxjava2:$roomVersion"
kapt "android.arch.persistence.room:compiler:$roomVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.1.51"
androidTestImplementation "android.arch.persistence.room:testing:$roomVersion"
// Dagger
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
implementation 'pl.charmas.android:android-reactive-location2:2.0#aar'
implementation 'com.google.android.gms:play-services-location:11.4.2'
implementation 'com.google.android.gms:play-services-places:11.4.2'
//Jackson
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.1'
implementation 'com.android.support:multidex:1.0.2'
}
Here is the error:
FAILURE: Build failed with an exception.
Execution failed for task ':location:transformClassesWithMultidexlistForDebugAndroidTest'.
java.io.IOException: Can't write [C:\TempAndroidProj\location\build\intermediates\multi-dex\androidTest\debug\componentClasses.jar] (Can't read [C:\Users\k.s.gradle\caches\transforms-1\files-1.1\testing-support-lib-0.1.aar\59aec2a639c884ff422cd31cc6e68cad\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/test/filters/RequiresDevice.class]))
So how can i exclude properly the duplicate zip entry?

Resources