Exception : mergeDebugResources in Android Studio - android

I got following Error if I try to add dependency in Top - level build.gradle file. This dependency is very much useful to add GCM in project without it GCM won't work:
Dependency :
classpath 'com.google.gms:google-services:1.5.0-beta2'
Error :-
Error:Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details
If I remove that dependency from top-level build.gradle the project compiles and run successfully.
If I add that file I got the error and Android Studio do not run project.
Please help me to get out of this error.
Edit
Here is my project level build.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.0.0-alpha6'
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
classpath 'com.google.gms:google-services:2.0.0-beta5'
// 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
}

try Changing latest version of dependency from HERE:
classpath 'com.google.gms:google-services:2.0.0-beta5'
Also make sure you are setting correct Gradle plugin dependency as well in root project gradle file.
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
So, your final project build.gradle file will look like
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
classpath 'com.google.gms:google-services:2.0.0-beta5'
}

Try this it should help.
buildTypes {
release {
multiDexEnabled true;
}
}

in your Gradle log, if you're getting bad/invalid PNG file then take a look at my answer at Android Studio Gradle 2.0.0-alpha1 build errors
Hope this helps...

Related

Trying to add module to project. Gradle DSL method not found: 'versionName()'

I am trying to add a epub reader library to a project I have already created. The library I am trying to add to my project as a moduel is the Folio Reader Library (https://github.com/FolioReader/FolioReader-Android). I have downloaded this library on my computer and have tried adding it through File -> New -> Import Module. However, during the process I received countless errors. My current one is this:
Gradle DSL method not found: 'versionName()'
Possible causes:
The project 'FolioReader-Android-master' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.4.1 and sync project
The project 'FolioReader-Android-master' may be using a version of Gradle
that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
This file is the file where the dependencies are declared for the Library.
FolioReader-Android-master:
build.gradle file:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
apply from: 'versions.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//moj
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
repositories {
mavenLocal()
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The error itself states that the problem arises because the project is using a version of the Gradle plug-in may not contain the method. I have updated the version to the newest one, however I still receive this error. Any suggestions on how I can solve this problem?
Problem solved by replacing
versionName 1
with
versionName "1.1"
in the Module level build.gradle file.

Excecution failed for task ':app:preDebugAndroidTestBuild'

I am completely new to android and kotlin programming. I just started learning android since yesterday. I have successfully created a project but it doesn't show me xml editor.
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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
}
Any idea to solve this problem
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}
Add the above line in your app.gradle file before dependencies block & replace compile to implementation.
In Android Studio , click on Terminal and execute this command.
gradlew app:dependencies
and then search for com.android.support:support-annotations.
Then in your app level gradle file , exculude the com.android.support:support-annotations dependency from the dependency which has the older version i.e 26.1.0. To learn how to exuclude go here.

Gradle project sync failed android studio version 2.2.3 ERROR

Well this is my first time using android studio and i keep getting an error message which says:
Gradle sync failed: Could not find method android() for arguments [build_43qncadg6ssgwl9025usbfvce$_run_closure3#c74f8ce] on root project 'MyApplication' of type org.gradle.api.Project.
Consult IDE log for more details
HERE IS THE CODE:
// 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.3.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
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
}
dependencies {
}
ERROR: could not find method android() for arguments.
What does this error mean? How can I solve this?
A typical Android project has a root project and a sub project containing the app. It seems you showed the build.gradle of the root project.
The android section would typically go into the sub project's build.gradle.

Build fails for GreenDao 3.2 with CompilerOptions.versionToJdkLevel

After updating to Android Studio 2.3 trying to build the project causes a build failure.
Execution failed for task ':app:greendao'.
org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(Ljava/lang/Object;)J
How to solve this issue?
The solution is to move
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
form app/build.gradle into top level build.gradle file.
Example:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
}
}

android Error:(44, 13) Failed to resolve com.esri.arcgis.android:arcgis-android:10.2.7

Every time I build my android project it gives me this Error
android Error:(44, 13) Failed to resolve com.esri.arcgis.android:arcgis-android:10.2.7
Can anyone help me regarding this ?
The problem is solved like that
1.
add the following lines
// Add the following ArcGIS repository
maven {
url 'https://esri.bintray.com/arcgis'
}
in the build.gradle of the project module
to be like that
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
//**Added .. for ArcGIS
maven {
url 'https://esri.bintray.com/arcgis'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
// Add the following ArcGIS repository
maven {
url 'https://esri.bintray.com/arcgis'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Also , I edited the version of arcgis dependency in the app module build.gradle to be like that
compile 'com.esri.arcgis.android:arcgis-android:10.2.8'
May be needful.
In the app module build.gradle file, within the dependencies block, add a directive to include the ArcGIS Runtime SDK for Android dependency to your app.
App module build.gradle file
Fallow all the steps from here
dependencies {
// Add ArcGIS Runtime SDK for Android dependency
compile 'com.esri.arcgis.android:arcgis-android:10.2.7'
}
This may be due to version mis-match of Android Studio. So, try giving latest dependencies in app level build.gradle. In my case I changed it from 10.2.6 to 10.2.8
compile 'com.esri.arcgis.android:arcgis-android:10.2.8'

Categories

Resources