Got prompted for an update and let it do its thing and got these errors everything worked fine before the update.
Information:Gradle tasks [:app:generateDebugSources,
:app:generateDebugAndroidTestSources, :app:mockableAndroidJar,
:app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources,
:app:compileDebugSources]
/Users/.../topografie/activity/FlashCardActivity.java
Error:(60, 14) error: cannot find symbol method
addOnPageChangeListener()
/Users/.../topografie/activity/MainActivity.java
Error:(87, 14) error: cannot find symbol method
addOnPageChangeListener(OnPageChangeListener)
/Users/.../topografie/activity/MuscleDetailActivity.java
Error:(58, 14) error: cannot find symbol method
addOnPageChangeListener()
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details. Information:BUILD FAILED in 2s Information:4 errors Information:0
warnings Information:See complete output in console
Gradle console says:
symbol: method addOnPageChangeListener(OnPageChangeListener)
location: variable pager of type ViewPager Note:
/Users/.../MuscleDetailActivity.java uses unchecked or unsafe
operations. Note: Recompile with -Xlint:unchecked for details. 1 error
I've come across several similar questions, but none of the answers worked for me. I've cleaned and rebuild the project and I updated all the dependencies in Gradle. EDIT: Gradle syncs fine, but the project build gives error
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.anatomie.bny.topografie"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/android-support-v13.jar')
compile files('libs/picasso-2.5.2.jar')
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.github.AndroidDeveloperLB:AutoFitTextView:4'
testCompile 'junit:junit:4.12'
}
Please help, I've been at it for hours and can't find a solution
Delete .gradle and .idea folder
And REBUILD
If that doesn't work, again delete .gradle and .idea folder
and RESTART
You can try my answer. And also restart Android Studio after following these steps.
Change the plugin version in your project-level build.gradle file as follows:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
then Rebuild project
Related
Till yesterday everything was working fine.
I didnt update anything in between.
But all of sudden, i am keep getting this error "Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt"
I tried updting sdk to 27.0.0, but still getting the same error message.
Tried deleting .gradle folder and build folder and cleaning project many times. But not help.
What went wrong here?
Here is my build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.udayrepo.doctortracker"
minSdkVersion 17
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'
}
}
}
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:26.0.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:design:26.0.1'
testCompile 'junit:junit:4.12'
}
The above error is really annoying without any clues where the problem is.
As many others said, i tried exploring replacing each of these libraries in my app.gradle file.
I search each of the latest packages in Android SDK Plackage and updated each package in my gradle file with below
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
testCompile 'junit:junit:4.12'
then it started working.
I am just sharing the solution as it may help others aswell. Just look for latest and update install required packages.
After updating my dependency versions in AndroidStudio3.1, I started getting the following error:
Information:Gradle tasks [:app:assembleDebug]
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Blabla\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\21.0\3a3d111be1be1b745edfa7d91678a12d7ed38709\guava-21.0.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Error:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24): java.util.Collection com.google.common.collect.BiMap.values()
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Blabla\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\21.0\3a3d111be1be1b745edfa7d91678a12d7ed38709\guava-21.0.jar
Information:BUILD FAILED in 6s
Information:4 errors
Information:0 warnings
Information:See complete output in console
I have already cleaned and rebuilt project. Checked my "multiDexEnabled true" and 'compile 'com.android.support:multidex:1.0.2' is added.
What else can I do?
EDIT: Adding build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.blabla"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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:27.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.jakewharton:butterknife:8.7.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.guava:guava:21.0'
compile 'com.microsoft.azure:azure-mobile-android:3.2.0#aar'
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4#aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-crash:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.maps.android:android-maps-utils:0.5+'
}
apply plugin: 'com.google.gms.google-services'
I had the same issue in react-native project,
the below lines worked for me,
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Update your Guava version
Guava 21 is Java 8 only.
Update your gradle to Guava version 27.0.1-android, which is compatible with Android:
Gradle 4.6+:
dependencies {
implementation 'com.google.guava:guava:27.0.1-android'
}
Previous Gradle versions:
dependencies {
compile 'com.google.guava:guava:27.0.1-android'
}
I had same problem and I solved it cleaning project and rebuilding it.
In Android Studio go to Build --> Clean Project and after, Build --> Rebuild Project
Hope it helps
I had the similar case when I switched to OkHttp 4.x. It turned out that I had to disable the method profiling in run configuration:
Edit Configurations -> app -> Profiling tab -> uncheck Enable advanced profiling. It solved my case but I cannot use profiling now on older devices.
In my case, I was getting the error because I was clicking the Debug 'app' button while my build variant was set to release. When I changed my build variant to debug, then clicked the Debug button again, the error went away. I hope this helps someone.
I had the same issue and my problem was dependency conflict.
I searched for the conflict via the gradle dependency tree:
gradlew app:dependencies
Then I excluded the module for the conflicting library (e.g org.json:json):
api ('<conflicting-library>',{
exclude group:'org.json', module:'json'
})
I'm trying to add a "room" to my project.
When I try to build a project, I get an error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
What I have already done:
Clean/Rebuild project
I added "multiDexEnabled true" in defaultConfig{}. Then I get the error:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [C:\Users\user1\AndroidStudioProjects\git\mobile\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\user1.gradle\caches\transforms-1\files-1.1\support-core-utils-26.1.0.aar\a6c34f6784b0b6bc5c2fc7a7815426da\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/content/PermissionChecker$PermissionResult.class]))
If I remove the "room" from my project, it is build without errors.
I'm using Android Studio 3, gradle build tools 3.0.0.
This is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "trsnet.gtp2.com"
minSdkVersion 17
targetSdkVersion 23
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile files('libs/commons-codec-1.9.jar')
compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-
dependencies.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support.constraint:constraint-layout:+'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
}
I was having this problem too and it took me quite a while to solve, but I finally got it. ROOM uses some of the support-v4 libraries so this is why you are getting the error that there are duplicate zip entries. In my situation, ROOM is using components from an earlier version than what I needed. So what worked for me (found here) is adding the following to the root level of the Gradle file:
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
What I found this does is it prevents libraries from including any support-v4 components, but then you have to manually include the necessary components for both ROOM and anything else you might need. If you need to find out exactly which libraries are duplicates then you can follow these instructions to look into each library and it's dependencies.
Slightly unrelated note: As of Gradle 3.0 using the compile configuration is deprecated and should be replace with implementation or api, a nice explanation can be found here.
I am extremely new to android and trying the firebase where i am trying out firebase auth and firebase database.
I could successfully complete the auth functionality and below is the gradle file contents for app module just after it.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.cirvi.laxmimobileshopee"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile "com.google.firebase:firebase-auth:9.0.2"
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Now for the next step i want to use firebase database in the same project and i update the gradle file by adding the dependency
compile 'com.google.firebase:firebase-database:9.6.1'
As soon as i do it and start the sync i get the following error
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.6.1.
Information:BUILD FAILED
Information:Total time: 2.86 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Below is the code for my project gradle file.
// 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:2.2.0'
classpath 'com.google.gms:google-services:3.1.0'
// 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
}
I tried to update the google service version in the project gradle file but then ran into other issues. As i am new to android and trying things out i am stuck and not able to figure out currently how to resolve this. Can anyone guide me or help me?
Try this
Go to project level build.gradle & check if it looks exactly like this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
set same dependency for both
implementation "com.google.firebase:firebase-auth:9.6.1"
implementation 'com.google.firebase:firebase-database:9.6.1'
Try this:
Build > Edit Libraries and Dependencies...
Now, search for available modules:
You have to use the same versions of firebase.
You used version 9.0.2 of auth and 9.6.1 of database.
Also I suggest to use the latest version of the firebase SDK
Add
com.google.firebase:firebase-auth:11.0.4
com.google.firebase:firebase-database:11.0.4
Add this dependency from your needs
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
When I am run my application in android studio error. I am new in android developing.
My Logtag is here:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:assembleDebug]
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:recyclerview-v7:.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/recyclerview-v7//recyclerview-v7-.pom
https://jcenter.bintray.com/com/android/support/recyclerview-v7//recyclerview-v7-.jar
file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.pom
file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.jar
file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.pom
file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.jar
Required by:
ShoppingMazza:app:unspecified
Information:BUILD FAILED
Information:Total time: 4.964 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.catalyst.android.shoppingmazza"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.android.support:recyclerview-v7:'
}
Error:
Error:A problem occurred configuring project ':app'. Could not
resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:recyclerview-v7:.
From error i can say you'll have to add the following gradle dependency :
compile 'com.android.support:recyclerview-v7:+'
EDIT:
Error:Execution failed for task ':app:dexDebug'. >
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with
non-zero exit value 1
For this error i think you are compiling JAR library twice. You are using
compile fileTree(dir: 'libs', include: ['*.jar'])
in build.gradle file so it will compile all library that has jar extension on libs folder, so You can remove this lines:
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
If issue still exists then issue is quite possibly due to exceeding the 65K methods dex limit imposed by Android. This problem can be solved either by cleaning the project, and removing some unused libraries and methods from dependencies in build.gradle, OR by adding multidex support.
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Did you forget the version? In your gradle config you should have something like this:
compile 'com.android.support:recyclerview-v7:23.0.1'
In my case, I deleted caches folder inside .gradle folder and then I added compile. It worked for me!