Tag Archives: Android Studio Error

[Solved] Android Studio Error: Error:Execution failed for task’:app:mergeDebugResources’


Error:Execution failed for task’:app:mergeDebugResources’



The image I added does not meet the review requirements of Android Studio, add two lines of code to disable the review



Add the following codes in build.gradle of the app directory.

android {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false

Android Studio Error: String index out of range 0 [How to Solve]

Android studio compilation project error: string index out of range 0

Compile the project after merging the SVN code. Android studio fails to compile the project. An error message appears: string index out of range 0

Cause: compilation fails due to conflicts caused by merging codes


Delete the other three files with the same name gradle.Properties , and there are no other three gradle.Properties files with the same name and different suffixes in the original project because of conflicts in the process of merging codes, and ->>> symbols that cannot be compiled, so delete ->>> symbol, build -- > Clear project or build -- > Rebuild project recompile the project, and the problem is solved.

Android studio reports an error when running the main() method

1.Error Content.
SourceSet with name ‘main’ not found
In the gradle.xml file in the .idea folder add
<option name="delegatedBuild" value="false" />
2. Error reporting:
Command line is too long. Shorten command line for ServiceStarter or also for Application default configuration.
In the workspace.xml file in the .idea folder, find the tag
<component name=”PropertiesComponent”>, add a line to the tag
<property name=”dynamic.classpath” value=”true” />

[Solved] Android Studio Error: ERROR: Cause: executing external native build for cmake

Recently, when editing a project using Android Studio, an error message “error: cause: executing external native build for cmake” appears. Therefore, open Gradle-wrapper.properties and find the following figure: because the as version of is 3.5.2

Open build.gradle


I open file -> Project structure, change the plug-in version from 3.5.2. To 3.4.0, and then synchronize again.

Android studio Error:Execution failed for task ‘: app:transformResourcesWithMergeJavaResForDebug ‘

Android studio error Error:Execution failed for task

Recently, when doing the face recognition check-in system based on Android platform, after importing the third party’s lib package, Android studio reported the following error:

Error:Execution failed for task ‘: app:transformResourcesWithMergeJavaResForDebug ’.
com.android.build . api.transform.TransformException : com.android.builder . packaging.DuplicateFileException : Duplicate files copied in APK META-INF/LICENSE
File1: E:\Workspaces\Swface\app\libs\httpcore-4.4.4.jar
File2: E:\Workspaces\Swface\app\libs\httpclient-4.5.2.jar

After consulting the data, it is found that there are duplicate contents loaded in the meta-inf directory of the jar package. Open the corresponding jar package
sure enough, both of the two jar packages have license, and further Click to find that the contents are exactly the same. However, it seems that the next three files are also duplicate (only there is no clear prompt in the error report), so we can solve them all at once
all Now that we know that it is caused by repeatedly loading files, the solution is to remove the repeatedly loaded files during compilation. The specific operations are as follows:

    1. Open app\ build.gradle File
    1. 2. Modify the configuration as follows:
buildTypes {
          ...... (omit part of the code)
          // Add the following code here
          packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/ASL2.0'
            exclude 'META-INF/notice.txt'

3. Rebuild project

A link to the original text is attached


Error:Execution failed for task ‘: app:transformDexArchiveWithExternalLibsDexMergerForDebug The solution

specific error message is as follows:

AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.app.FragmentTransitionCompat21$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

there are several methods (the last one is available) :

1. Add “multiDexEnabled true” to defaultConfig

android {} :

defaultConfig {
        multiDexEnabled true
        applicationId "com.example.m1571.mycolorfulnews"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

this method has no effect on my project

2. Add:

to gradle. Properties China


this method has no effect on my project

3. Remove conflicting dependencies:

implementation 'com.android.support:appcompat-v7:28.0.0'

delete the above v7 package, you can run