0

I have imported a project from Eclipse to Android Studio. When I am building the project its shows a "Manifest merger failed with multiple errors, see logs" error.

I have tried to update the sdk version (min and target) in the app module but it is seems to have something more in conflict. The log is not helping me at all...

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':zafraApp:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
    at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:524)
    at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at sun.reflect.GeneratedMethodAccessor600.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 32 more

No problems in my main code, maybe in the gradle files or in the manifest file?

ECLIPSE ANDROID PROJECT IMPORT SUMMARY
======================================

Manifest Merging:
-----------------
Your project uses libraries that provide manifests, and your Eclipse
project did not explicitly turn on manifest merging. In Android Gradle
projects, manifests are always merged (meaning that contents from your
libraries' manifests will be merged into the app manifest. If you had
manually copied contents from library manifests into your app manifest
you may need to remove these for the app to build correctly.

Ignored Files:
--------------
The following files were *not* copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:

From CaptureActivity:
* ant.properties
* build.xml
From ZafraApp:
* app_icono-web.png
* ic_launcher-web.png
* proguard-project.txt
From library:
* pom.xml

Replaced Jars with Dependencies:
--------------------------------
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:

android-support-v4.jar => com.android.support:support-v4:18.0.0
android-support-v7-appcompat.jar => com.android.support:appcompat-v7:18.0.0

Replaced Libraries with Dependencies:
-------------------------------------
The importer recognized the following library projects as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the source files in your project were of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the library replacement in the import wizard and try
again:

android-support-v7-appcompat => [com.android.support:appcompat-v7:18.0.0]

Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:

In CaptureActivity:
* AndroidManifest.xml => captureActivity\src\main\AndroidManifest.xml
* assets\ => captureActivity\src\main\assets\
* libs\core.jar => captureActivity\libs\core.jar
* proguard.cfg => captureActivity\proguard.cfg
* res\ => captureActivity\src\main\res\
* src\ => captureActivity\src\main\java\
In library:
* AndroidManifest.xml => library\src\main\AndroidManifest.xml
* assets\ => library\src\main\assets
* res\ => library\src\main\res\
* src\ => library\src\main\java\
In ZafraApp:
* AndroidManifest.xml => zafraApp\src\main\AndroidManifest.xml
* assets\ => zafraApp\src\main\assets
* res\ => zafraApp\src\main\res\
* src\ => zafraApp\src\main\java\
* galeria_monumentos_aljimez_foto3.JPG => galeria_monumentos_aljimez_foto3.jpg
* galeria_monumentos_casagrande_foto2.JPG => galeria_monumentos_casagrande_foto2.jpg
* galeria_monumentos_casagrande_foto3.JPG => galeria_monumentos_casagrande_foto3.jpg
* galeria_monumentos_casagrande_foto4.JPG => galeria_monumentos_casagrande_foto4.jpg
* galeria_monumentos_clara_foto3.JPG => galeria_monumentos_clara_foto3.jpg
* galeria_monumentos_clara_foto4.JPG => galeria_monumentos_clara_foto4.jpg
* galeria_monumentos_santiago_foto2.JPG => galeria_monumentos_santiago_foto2.jpg

Next Steps:
-----------
You can now build the project. The Gradle project needs network
connectivity to download dependencies.

Bugs:
-----
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.

(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
Project Structure

zafraApp its the main module, the other two (library and captureactivity) are support libraries. Is that correct?

New Update:

The merged errors can be seen clicking in "Merged Manifest", right in the botton enter image description here

Clicking on them i can fix the merger problem, but i have some kind of conflict with the appcompat library. The problem seems to be here: enter image description here

Delug3
  • 63
  • 8
  • afaik, Android Studio can't totally import the eclipse project, especially the directory hierarchy from eclipse to Android Studio. Please check if your project hierarchy after importing is the same as Android Studio standard project hierarchy. – ישו אוהב אותך Jun 27 '18 at 02:59
  • Hi, 2 libraries that i have been using are created as a module in gradle, maybe that can be the problem, but I can not find the solution.I am going to include the import summary, hopes that helps – Delug3 Jun 27 '18 at 08:59
  • It seems ok. Check all the module manifest. – ישו אוהב אותך Jun 27 '18 at 09:29

3 Answers3

1

Change minSdkVersion for both library and application and same for all. In all manifest file set android:allowBackup="false".

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
Vishal Dobariya
  • 321
  • 1
  • 11
  • I have changed the minsdkversion in both of them but happens the same. It is giving an error in the compilesdkversion too, Im going to try to update that level too. The error seems to be in the build gradle, but no idea where! hehe – Delug3 Jun 28 '18 at 14:06
0

I have checked the manifest and seems fine too, my problem seems to be in the gradle files, I have been reading about the problems that can appear with differents sdk versions, mine are:

Main module: zafraapp

apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "ayto.appzafra"
        minSdkVersion 8
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':library')
    compile project(':captureActivity')
    compile 'com.android.support:appcompat-v7:18.0.0'
}

Second(Library)

apply plugin: 'com.android.library'

android {
    compileSdkVersion 'Google Inc.:Google APIs:17'
    buildToolsVersion "27.0.3"

    defaultConfig {
        minSdkVersion 4
        targetSdkVersion 4
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
}

And the last one, a library too:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 'Google Inc.:Google APIs:17'
    buildToolsVersion "27.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 7
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard.cfg'
        }
    }
}

dependencies {
    compile files('libs/core.jar')
}

In the manifest, the sdk version is completely different too,I am really confuse right now haha

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" 
        />

Should I have to target the same version and minsdk?

Delug3
  • 63
  • 8
  • I am also facing same issue .Any solution for this? – Jack Jun 29 '18 at 10:54
  • I am playing with the values, the problem is there...but dont know where yet – Delug3 Jun 29 '18 at 11:11
  • ok i suggest reading this answer from SO .https://stackoverflow.com/questions/27790209/how-to-use-the-new-manifest-merger-of-android-studio-and-gradle – Jack Jun 29 '18 at 12:01
  • thanks! I have updated the support libraries with the same version and now the gradle files seems ok. My problem now is during compilation: "error: cannot find symbol".... – Delug3 Jul 03 '18 at 10:01
  • what is the name of symbol? – Jack Jul 03 '18 at 10:08
  • error: cannot find symbol class ActionBarActivity , I think the solution is this one: https://stackoverflow.com/questions/48776962/cannot-find-symbol-class-actionbaractivity-android-recycled-view – Delug3 Jul 03 '18 at 15:52
  • What is the current problem in your code? I fixed my issues, may be i can help – Jack Jul 04 '18 at 12:23
  • The error is gone!, I just have to update the libraries to a more recent version, all of them at the same level. Now it is working, just adding new code and improving the layout :) – Delug3 Jul 06 '18 at 09:46
0

The solution was to update the libraries with newer versions maintaining the same version level.

Delug3
  • 63
  • 8